diff --git a/.github/workflows/test_and_deploy.yml b/.github/workflows/test_and_deploy.yml index 30a1d74..afa6983 100644 --- a/.github/workflows/test_and_deploy.yml +++ b/.github/workflows/test_and_deploy.yml @@ -26,9 +26,6 @@ jobs: needs: [linting, manifest] name: ${{ matrix.os }} py${{ matrix.python-version }} runs-on: ${{ matrix.os }} - env: - # pooch cache dir - BRAINGLOBE_TEST_DATA_DIR: "~/.pooch_cache" strategy: matrix: @@ -45,18 +42,10 @@ jobs: python-version: "3.12" steps: - - name: Cache brainglobe directory - uses: actions/cache@v4 - with: - path: | # ensure we don't cache any interrupted atlas download and extraction, if e.g. we cancel the workflow manually - ~/.brainglobe - !~/.brainglobe/atlas.tar.gz - key: atlases - - - name: Cache pooch data + - name: Cache data uses: actions/cache@v4 with: - path: "~/.pooch_cache" + path: "~/.brainglobe" # hash on conftest in case url changes key: ${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/conftest.py') }} @@ -80,8 +69,7 @@ jobs: runs-on: ubuntu-latest env: NUMBA_DISABLE_JIT: "1" - # pooch cache dir - BRAINGLOBE_TEST_DATA_DIR: "~/.pooch_cache" + steps: - name: Cache pooch data @@ -89,7 +77,7 @@ jobs: with: path: "~/.pooch_cache" # hash on conftest in case url changes - key: ${{ runner.os }}-3.11-${{ hashFiles('**/conftest.py') }} + key: ${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/conftest.py') }} - name: Set up Python uses: actions/setup-python@v4 diff --git a/pyproject.toml b/pyproject.toml index a6e60cf..485b4f8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -129,5 +129,4 @@ passenv = DISPLAY XAUTHORITY PYVISTA_OFF_SCREEN - BRAINGLOBE_TEST_DATA_DIR """ diff --git a/tests/tests/conftest.py b/tests/tests/conftest.py index f0a78cc..a554762 100644 --- a/tests/tests/conftest.py +++ b/tests/tests/conftest.py @@ -20,12 +20,12 @@ def test_data_registry(): """ registry = pooch.create( - path=pooch.os_cache("brainglobe_test_data"), + path=Path.home() / ".brainglobe" / "test_data", base_url="https://gin.g-node.org/BrainGlobe/test-data/raw/master/", registry={ "cellfinder/cells-z-1000-1050.xml": None, "cellfinder/other-cells-z-1000-1050.xml": None, + "brainglobe-utils/points_transform_brainreg_directory.zip": "a1997f61a5efa752584ea91b7c479506343215bb91f5be09a72349f24e21fc54", # noqa: E501 }, - env="BRAINGLOBE_TEST_DATA_DIR", ) return registry diff --git a/tests/tests/test_brainmapper/test_transform_widget.py b/tests/tests/test_brainmapper/test_transform_widget.py index 231fa06..89643e6 100644 --- a/tests/tests/test_brainmapper/test_transform_widget.py +++ b/tests/tests/test_brainmapper/test_transform_widget.py @@ -165,17 +165,19 @@ def transformation_widget_with_napari_layers( @pytest.fixture -def brainreg_directory() -> Path: - download_path = Path.home() / ".brainglobe" / "test_data" - _ = pooch.retrieve( - url="https://gin.g-node.org/BrainGlobe/test-data/raw/master/" +def brainreg_directory(test_data_registry) -> Path: + _ = test_data_registry.fetch( "brainglobe-utils/points_transform_brainreg_directory.zip", - known_hash="a1997f61a5efa752584ea91b7c479506343215bb91f5be09a72349f24e21fc54", - path=download_path, progressbar=True, - processor=pooch.Unzip(extract_dir="."), + processor=pooch.Unzip(extract_dir=""), + ) + return ( + Path.home() + / ".brainglobe" + / "test_data" + / "brainglobe-utils" + / "points_transform_brainreg_directory" ) - return download_path / "points_transform_brainreg_directory" @pytest.fixture