Skip to content

Commit 3ebd8e3

Browse files
committed
Merge branch 'develop' into dev-define-engines-abc
# Conflicts: # tests/models/test_feature_extractor.py # tests/models/test_multi_task_segmentor.py # tests/models/test_nucleus_instance_segmentor.py # tests/models/test_patch_predictor.py # tests/models/test_semantic_segmentation.py # tiatoolbox/models/architecture/__init__.py
2 parents cf36794 + 9d0c40c commit 3ebd8e3

25 files changed

+640
-550
lines changed

requirements/requirements.conda.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ dependencies:
99
- openslide
1010
- pip>=20.0.2
1111
- pixman>=0.39.0
12-
- python>=3.9, <=3.12
12+
- python>=3.10, <=3.13
1313
- pip:
1414
- -r requirements.txt

requirements/requirements.dev.conda.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ dependencies:
99
- openslide
1010
- pip>=20.0.2
1111
- pixman>=0.39.0
12-
- python>=3.9, <=3.12
12+
- python>=3.10, <=3.13
1313
- pip:
1414
- -r requirements_dev.txt

requirements/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ filelock>=3.9.0
99
flask>=2.2.2
1010
flask-cors>=4.0.0
1111
glymur>=0.12.7
12+
huggingface_hub>=0.33.3
1213
imagecodecs>=2022.9.26
1314
joblib>=1.1.1
1415
jupyterlab>=3.5.2

requirements/requirements.win64.conda.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ dependencies:
99
- openjpeg>=2.4.0
1010
- pip>=20.0.2
1111
- pixman>=0.39.0
12-
- python>=3.9, <=3.12
12+
- python>=3.10, <=3.13
1313
- pip:
1414
- -r requirements.txt

requirements/requirements.win64.dev.conda.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ dependencies:
99
- openjpeg>=2.4.0
1010
- pip>=20.0.2
1111
- pixman>=0.39.0
12-
- python>=3.9, <=3.12
12+
- python>=3.10, <=3.13
1313
- pip:
1414
- -r requirements_dev.txt

tests/conftest.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -658,3 +658,39 @@ def timed(fn: Callable, *args: object) -> (Callable, float):
658658
end = time.time()
659659
compile_time = end - start
660660
return result, compile_time
661+
662+
663+
_tmp_paths: list[Path] = []
664+
665+
666+
@pytest.fixture
667+
def track_tmp_path(tmp_path: Path) -> Path:
668+
"""This fixture tracks `tmp_path` for clean up.
669+
670+
Fixture that wraps pytest's built-in `tmp_path` and tracks each temporary path
671+
for later cleanup at the module level.
672+
673+
Returns:
674+
Path: The temporary directory path for the current test function.
675+
676+
"""
677+
_tmp_paths.append(tmp_path)
678+
return tmp_path
679+
680+
681+
@pytest.fixture(scope="module", autouse=True)
682+
def module_teardown() -> None:
683+
"""This module tears down temporary data directories.
684+
685+
Module-scoped fixture that automatically runs after all tests in a module.
686+
It cleans up all temporary paths tracked during the module's execution.
687+
688+
Yields:
689+
None: Allows pytest to run tests before executing the teardown logic.
690+
691+
"""
692+
yield
693+
for path in _tmp_paths:
694+
if path.exists():
695+
shutil.rmtree(path)
696+
print(f"Cleaned up: {path}")

tests/models/test_arch_micronet.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def test_value_error() -> None:
5454
toolbox_env.running_on_ci() or not ON_GPU,
5555
reason="Local test on machine with GPU.",
5656
)
57-
def test_micronet_output(remote_sample: Callable, tmp_path: Path) -> None:
57+
def test_micronet_output(remote_sample: Callable, track_tmp_path: Path) -> None:
5858
"""Test the output of MicroNet."""
5959
svs_1_small = Path(remote_sample("svs-1-small"))
6060
micronet_output = Path(remote_sample("micronet-output"))
@@ -74,7 +74,7 @@ def test_micronet_output(remote_sample: Callable, tmp_path: Path) -> None:
7474
imgs=[
7575
svs_1_small,
7676
],
77-
save_dir=tmp_path / "output",
77+
save_dir=track_tmp_path / "output",
7878
)
7979

8080
output = np.load(output[0][1] + ".raw.0.npy")

tests/models/test_dataset.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,9 @@ def test_kather_nonexisting_dir() -> None:
9797
_ = KatherPatchDataset(save_dir_path="non-existing-path")
9898

9999

100-
def test_kather_dataset(tmp_path: Path) -> None:
100+
def test_kather_dataset(track_tmp_path: Path) -> None:
101101
"""Test for kather patch dataset."""
102-
save_dir_path = tmp_path
102+
save_dir_path = track_tmp_path
103103

104104
# save to temporary location
105105
# remove previously generated data

0 commit comments

Comments
 (0)