Skip to content

Commit 4fc3c85

Browse files
authored
Merge pull request #10 from jluethi/2_tests_for_2d_to_3d
Add coverage to CI
2 parents e277acc + 4d5d203 commit 4fc3c85

File tree

5 files changed

+28
-9
lines changed

5 files changed

+28
-9
lines changed

.github/workflows/ci_pip.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
cache: "pip"
3131

3232
- name: Install package
33-
run: python -m pip install .[dev,test]
33+
run: python -m pip install -e .[dev,test]
3434

3535
- name: Install some testing dependencies (hard-coded)
3636
run: python -m pip install pytest devtools jsonschema requests wget pooch
@@ -46,7 +46,7 @@ jobs:
4646
run: pytest --color=yes --cov --cov-report=xml --cov-report=term-missing -s --log-cli-level debug
4747

4848
- name: Upload coverage reports to Codecov
49-
uses: codecov/codecov-action@v4.0.1
49+
uses: codecov/codecov-action@v4.3.1
5050
with:
5151
token: ${{ secrets.CODECOV_TOKEN }}
5252
slug: jluethi/fractal-helper-tasks

README.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# fractal-helper-tasks
22

3+
[![License](https://img.shields.io/badge/License-BSD_3--Clause-blue.svg)](LICENSE)
4+
![Python version](https://img.shields.io/badge/python-%3E%3D3.9-blue)
5+
![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/jluethi/fractal-helper-tasks/your-workflow-file.yml?branch=main)
6+
[![codecov](https://codecov.io/gh/jluethi/fractal-helper-tasks/graph/badge.svg?token=ednmg2GzOw)](https://codecov.io/gh/jluethi/fractal-helper-tasks)
7+
38
Collection of Fractal helper tasks
49

510
## Development instructions

pyproject.toml

+9-3
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,13 @@ extend-ignore = [
6969
"tests/*.py" = ["D", "S"]
7070
"setup.py" = ["D"]
7171

72-
[tool.deptry]
73-
exclude = [
74-
'tests', 'examples'
72+
[tool.coverage.run]
73+
# Include only the specific package directories for coverage, exclude tests
74+
include = [
75+
"src/fractal_helper_tasks/*"
76+
]
77+
omit = [
78+
"*/tests/*",
79+
"*_test.py",
80+
"setup.py"
7581
]

tests/conftest.py

-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ def zenodo_zarr(testdata_path: Path) -> list[str]:
5353
f"{file_name}.zip", processor=pooch.Unzip(extract_dir=file_name)
5454
)
5555
zarr_full_path = file_paths[0].split(file_name)[0] + file_name
56-
print(zarr_full_path)
5756
folder = folders[ind]
5857

5958
# 2) Copy the downloaded Zarr into tests/data
+12-3
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,29 @@
11
"""Test copy 2D to 3D segmentation."""
22

33
import dask.array as da
4+
import pytest
45
import zarr
56

67
from fractal_helper_tasks.convert_2D_segmentation_to_3D import (
78
convert_2D_segmentation_to_3D,
89
)
910

1011

11-
def test_2d_to_3d(tmp_zenodo_zarr: list[str]):
12+
@pytest.mark.parametrize("new_label_name", [None, "nuclei_new"])
13+
def test_2d_to_3d(tmp_zenodo_zarr: list[str], new_label_name):
1214
zarr_url = f"{tmp_zenodo_zarr[1]}/B/03/0"
1315
label_name = "nuclei"
1416

1517
convert_2D_segmentation_to_3D(
1618
zarr_url=zarr_url,
1719
label_name=label_name,
20+
new_label_name=new_label_name,
1821
)
19-
zarr_3D_label_url = f"{tmp_zenodo_zarr[0]}/B/03/0/labels/{label_name}"
22+
23+
if not new_label_name:
24+
new_label_name = label_name
25+
26+
zarr_3D_label_url = f"{tmp_zenodo_zarr[0]}/B/03/0/labels/{new_label_name}"
2027
# Check that the label has been copied correctly
2128
with zarr.open(zarr_3D_label_url, mode="rw+") as zarr_img:
2229
zarr_3D = da.from_zarr(zarr_img[0])
@@ -25,7 +32,9 @@ def test_2d_to_3d(tmp_zenodo_zarr: list[str]):
2532

2633
# TODO: Add custom ROI tables to be copied to 3D
2734

28-
# TODO: Add test with new label name, new table names
35+
# TODO: Add a feature table & have it copied over
36+
37+
# TODO: Add test with new table names
2938

3039
# TODO: Create a version of the test data where image suffixes need to be
3140
# changed, run tests on those

0 commit comments

Comments
 (0)