From ce7acdc41ac0aa2145711beb22555700963aa6c6 Mon Sep 17 00:00:00 2001 From: Igor Tatarnikov <61896994+IgorTatarnikov@users.noreply.github.com> Date: Wed, 12 Feb 2025 11:06:07 +0000 Subject: [PATCH] Adds fixture to download atlases for test_validation.py (#498) --- tests/atlasgen/conftest.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 tests/atlasgen/conftest.py diff --git a/tests/atlasgen/conftest.py b/tests/atlasgen/conftest.py new file mode 100644 index 00000000..28d76668 --- /dev/null +++ b/tests/atlasgen/conftest.py @@ -0,0 +1,21 @@ +from pathlib import Path + +import pytest + +from brainglobe_atlasapi import BrainGlobeAtlas + + +@pytest.fixture(autouse=True) +def setup_preexisting_local_atlases(): + """Automatically setup all tests to have three downloaded atlases + in the test user data.""" + preexisting_atlases = [ + ("example_mouse_100um", "v1.2"), + ("allen_mouse_100um", "v1.2"), + ("kim_dev_mouse_e11-5_mri-adc_31.5um", "v1.3"), + ] + for atlas_name, version in preexisting_atlases: + if not Path.exists( + Path.home() / f".brainglobe/{atlas_name}_{version}" + ): + _ = BrainGlobeAtlas(atlas_name)