diff --git a/.ci_helpers/docker/setup-services.py b/.ci_helpers/docker/setup-services.py index b460e6766..c5b2f8c25 100755 --- a/.ci_helpers/docker/setup-services.py +++ b/.ci_helpers/docker/setup-services.py @@ -31,11 +31,7 @@ def get_pooch_data_path() -> Path: """Return path to the Pooch test data cache.""" ver = os.getenv("ECHOPYPE_DATA_VERSION", "v0.11.1a2") cache_dir = Path(pooch.os_cache("echopype")) / ver - if not cache_dir.exists(): - raise FileNotFoundError( - f"Pooch cache directory not found: {cache_dir}\n" - "Make sure test data was fetched via conftest.py" - ) + cache_dir.mkdir(parents=True, exist_ok=True) return cache_dir diff --git a/docs/source/contrib_setup.md b/docs/source/contrib_setup.md index ab7679ca0..311da5d12 100644 --- a/docs/source/contrib_setup.md +++ b/docs/source/contrib_setup.md @@ -47,6 +47,20 @@ To create an environment for developing Echopype, we recommend the following ste pip install -e ".[plot]" ``` +For a fresh local setup, enable the Pooch-based test data fetch before running tests. + +On Linux/macOS: +```shell +export USE_POOCH=True +``` + +On Windows PowerShell: +```shell +$env:USE_POOCH="True" +``` + +This allows the required test data to be downloaded into the local Pooch cache on first run. + :::{tip} We recommend using Mamba to get around Conda's sometimes slow or stuck behavior when solving dependencies. See [Mamba's documentation](https://mamba.readthedocs.io/en/latest/) for installation and usage. diff --git a/echopype/tests/conftest.py b/echopype/tests/conftest.py index 6b1f9513c..82dd22f9d 100644 --- a/echopype/tests/conftest.py +++ b/echopype/tests/conftest.py @@ -69,9 +69,11 @@ base_url=base, version=ver, registry=registry, - retry_if_failed=1, + retry_if_failed=5, ) + downloader = pooch.HTTPDownloader(timeout=300) + def _unpack(fname, action, pooch_instance): z = Path(fname) out = z.parent / z.stem @@ -125,12 +127,11 @@ def _unpack(fname, action, pooch_instance): return str(out) - for b in bundles: url = base.format(version=ver) + b print(f"[echopype-ci] fetching bundle: {b}") - print(f"[echopype-ci] → URL: {url}") - EP.fetch(b, processor=_unpack, progressbar=False) + print(f"[echopype-ci] -> URL: {url}") + EP.fetch(b, processor=_unpack, progressbar=False, downloader=downloader) print( "\n[echopype-ci] TEST_DATA_FOLDER\n" diff --git a/requirements-dev.txt b/requirements-dev.txt index c4f35dc11..cf63c2f7d 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -25,3 +25,4 @@ sphinx_rtd_theme sphinxcontrib-mermaid twine wheel +pooch