Fetch dataset (download if missing and requested by environment).
(f)
| 98 | |
| 99 | |
| 100 | def _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 |
no test coverage detected
searching dependent graphs…