MCPcopy
hub / github.com/scikit-learn/scikit-learn / _fetch_fixture

Function _fetch_fixture

sklearn/conftest.py:100–114  ·  view source on GitHub ↗

Fetch dataset (download if missing and requested by environment).

(f)

Source from the content-addressed store, hash-verified

98
99
100def _fetch_fixture(f):
101 """Fetch dataset (download if missing and requested by environment)."""
102 download_if_missing = environ.get("SKLEARN_SKIP_NETWORK_TESTS", "1") == "0"
103
104 @wraps(f)
105 def wrapped(*args, **kwargs):
106 kwargs["download_if_missing"] = download_if_missing
107 try:
108 return f(*args, **kwargs)
109 except OSError as e:
110 if str(e) != "Data not found and `download_if_missing` is False":
111 raise
112 pytest.skip("test is enabled when SKLEARN_SKIP_NETWORK_TESTS=0")
113
114 return pytest.fixture(lambda: wrapped)
115
116
117# Adds fixtures for fetching data

Callers 1

conftest.pyFile · 0.85

Calls 1

getMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…