Skip to content

Commit 95bfca6

Browse files
authored
feat(tests): add test dataset downloading and extraction helpers (#201)
## Release Notes - **New Features** - Enhanced dataset downloading functionality with progress tracking and timeout management - Improved dataset extraction with parallel processing support - **Improvements** - Refined GitHub release management - Updated test data handling and fixtures - Improved logging and error handling for dataset operations - **Changes** - Renamed `GitHubReleaseManager` to `MedImageTestData` - Updated variable names for better clarity in various modules - Adjusted DICOM file saving parameters - **Testing** - Added new test cases for dataset integrity and download processes - Enhanced type annotations and test fixtures
1 parent df23476 commit 95bfca6

20 files changed

+387
-250
lines changed

devnotes/testing.md

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Testing Information
2+
3+
Med-imagetools uses the `pytest` framework with `pixi`
4+
to assist with testing, and `coverage` to measure test coverage.
5+
6+
Mainly, being able to run a test suite across a matrix of
7+
python environments in CI/CD automatically.
8+
9+
See the `test` feature in the `pixi.toml` file for the
10+
dependencies, and tasks.
11+
12+
## Data
13+
14+
As of January 2025, the test data is downloaded from the
15+
[`bhklab/med-image_test-data`](https://github.com/bhklab/med-image_test-data)
16+
which is an automated pipeline that uses `snakemake` to query,
17+
download and prepare the data. The pipeline is run on
18+
GitHub Actions, and the data is uploaded to the `releases`
19+
section of the repository where it is then sourced by
20+
many packages.
21+
22+
Med-Imagetools has an interface in `src/imgtools/datasets` that
23+
can be used to download the data, and prepare it for testing.
24+
If users want to use the data, they need to install the package with
25+
`med-imagetools[test]` so it has the dependencies to download the data.
26+
27+
our `pixi` configuration includes the optional-dependencies for the entire
28+
package so we dont have to worry much about it.
29+

pixi.lock

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pixi.toml

+1-3
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,8 @@ pytest-cov = "*"
6161
pytest-mock = ">=3.14.0,<4"
6262
sqlalchemy-stubs = ">=0.4,<0.5"
6363

64-
6564
[feature.test.tasks.test]
6665
cmd = "pytest -c config/pytest.ini --rootdir . --basetemp='./tests/temp'"
67-
inputs = ["src", "tests", "config/pytest.ini", "config/coverage.toml"]
6866
description = "Run pytest (make sure to run in root directory)"
6967

7068
[feature.test.tasks.test_ci]
@@ -77,7 +75,7 @@ depends-on = ["test"]
7775
description = "Run pytest and generate coverage report"
7876

7977
[feature.test.tasks.clean_tests]
80-
cmd = "rm -rf .pytest_cache data tests/temp temp_outputs"
78+
cmd = "rm -rf .pytest_cache data tests/temp temp_outputs .cache"
8179
############################################## DOCS ###############################################
8280
[feature.docs.dependencies]
8381
mkdocs = "*"

pyproject.toml

+7-2
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,14 @@ requires = ["hatchling"]
8181
directory = "dist"
8282

8383
[tool.hatch.build.targets.wheel]
84+
# Automatically discovers packages in `src/`
8485
packages = ["src/imgtools"]
85-
include = ["pyproject.toml", "README.md", "src/**"]
86-
86+
include = [
87+
"pyproject.toml",
88+
"README.md",
89+
"src/imgtools/py.typed",
90+
"src/**"
91+
]
8792

8893
[tool.semantic_release]
8994
version_variables = ["src/imgtools/__init__.py:__version__"]

src/imgtools/datasets/__init__.py

-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
from .github_helper import (
22
GitHubRelease,
33
GitHubReleaseAsset,
4-
GitHubReleaseManager,
54
MedImageTestData,
65
)
76

87
__all__ = [
98
"GitHubRelease",
109
"GitHubReleaseAsset",
11-
"GitHubReleaseManager",
1210
"MedImageTestData",
1311
]

0 commit comments

Comments
 (0)