Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add fixtures to pooch.fetch more image data from GIN #2

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ dev = [
"coverage",
"mypy",
"pre-commit",
"pooch",
"pyqt5",
"pytest-cov",
"pytest-qt",
Expand Down
53 changes: 53 additions & 0 deletions tests/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import pooch
import pytest

from brainglobe_utils.image_io import load_any


@pytest.fixture
def data_path():
Expand All @@ -25,7 +27,58 @@ def test_data_registry():
registry={
"cellfinder/cells-z-1000-1050.xml": None,
"cellfinder/other-cells-z-1000-1050.xml": None,
"cellfinder/bright_brain.zip": None,
"cellfinder/edge_cells_brain.zip": None,
},
env="BRAINGLOBE_TEST_DATA_DIR",
)
return registry


@pytest.fixture
def bright_brain_path(test_data_registry):
"""Fetches and unzips the contents of 'cellfinder/bright_brain.zip'
from GIN test data and returns the path to unzipped local folder."""
bright_brain_relative_path = "cellfinder/bright_brain"
_ = test_data_registry.fetch(
f"{bright_brain_relative_path}.zip",
processor=pooch.Unzip(extract_dir="./"),
progressbar=True,
)
bright_brain_absolute_path = (
Path(test_data_registry.path) / bright_brain_relative_path
)
assert bright_brain_absolute_path.exists()
return bright_brain_absolute_path


@pytest.fixture
def edge_cells_brain_path(test_data_registry):
"""Fetches and unzips the contents of 'cellfinder/edge_cells_brain.zip'
from GIN test data and returns the path to unzipped local folder."""
edge_cells_brain_relative_path = "cellfinder/edge_cells_brain"
_ = test_data_registry.fetch(
f"{edge_cells_brain_relative_path}.zip",
processor=pooch.Unzip(extract_dir="./"),
progressbar=True,
)
edge_cells_brain_absolute_path = (
Path(test_data_registry.path) / edge_cells_brain_relative_path
)
assert edge_cells_brain_absolute_path.exists()
return edge_cells_brain_absolute_path


# FIXME: putting the two tests below as proof of concept
# and smoke tests for newly added image data on GIN.
# Please refactor into sensible tests in other files..
@pytest.mark.xfail
def test_bright_brain(bright_brain_path):
bright_brain_signal = load_any(bright_brain_path / "signal/")
assert not bright_brain_signal.shape


@pytest.mark.xfail
def test_edge_cells_brain(edge_cells_brain_path):
edge_cells_brain_signal = load_any(edge_cells_brain_path / "signal/")
assert not edge_cells_brain_signal