Skip to content

Commit

Permalink
Move all test data to one registry, saved to .brainglobe
Browse files Browse the repository at this point in the history
  • Loading branch information
adamltyson committed Jul 23, 2024
1 parent be1730b commit 14305ba
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 27 deletions.
20 changes: 4 additions & 16 deletions .github/workflows/test_and_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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') }}

Expand All @@ -80,16 +69,15 @@ jobs:
runs-on: ubuntu-latest
env:
NUMBA_DISABLE_JIT: "1"
# pooch cache dir
BRAINGLOBE_TEST_DATA_DIR: "~/.pooch_cache"


steps:
- name: Cache pooch data
uses: actions/cache@v4
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
Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -129,5 +129,4 @@ passenv =
DISPLAY
XAUTHORITY
PYVISTA_OFF_SCREEN
BRAINGLOBE_TEST_DATA_DIR
"""
4 changes: 2 additions & 2 deletions tests/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
18 changes: 10 additions & 8 deletions tests/tests/test_brainmapper/test_transform_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 14305ba

Please sign in to comment.