Skip to content

Commit 511addf

Browse files
committed
chore: adjust conftest.py
1 parent fea9edf commit 511addf

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

conftest.py

+15-15
Original file line numberDiff line numberDiff line change
@@ -80,44 +80,44 @@ def img_dir() -> Path:
8080
def img_patch_dir() -> Path:
8181
"""Return a path to directory with a few test images."""
8282
path = Path().resolve()
83-
return path / "cellseg_models_pytorch/datasets/tests/data/imgs"
83+
return path / "cellseg_models_pytorch/utils/tests/data/imgs"
8484

8585

8686
@pytest.fixture(scope="package")
8787
def mask_patch_dir() -> Path:
8888
"""Return a path to directory with a few test images."""
8989
path = Path().resolve()
90-
return path / "cellseg_models_pytorch/datasets/tests/data/masks"
91-
90+
dir = path / "cellseg_models_pytorch/utils/tests/data/masks"
91+
assert dir.exists(), f"Directory does not exist: {dir}"
92+
assert dir.is_dir(), f"Path is not a directory: {dir}"
93+
return dir
9294

9395
@pytest.fixture(scope="package")
94-
def type_map_tensor() -> torch.Tensor:
95-
"""Return a dummy type map target tensor. Shape (8, 320, 320)."""
96+
def img_sample() -> np.ndarray:
97+
"""Read in test RGB img."""
9698
path = Path().resolve()
97-
path = path / "cellseg_models_pytorch/training/tests/data/type_target_batch8.pt"
98-
return torch.load(path.as_posix())
99+
return FileHandler.read_img(path / "cellseg_models_pytorch/utils/tests/data/HE.png")
99100

100101

101102
@pytest.fixture(scope="package")
102-
def sem_map_tensor() -> torch.Tensor:
103-
"""Return a dummy semantic map target tensor. Shape (8, 320, 320)."""
103+
def img_sample512() -> np.ndarray:
104+
"""Read in test RGB img."""
104105
path = Path().resolve()
105-
path = path / "cellseg_models_pytorch/training/tests/data/sem_target_batch8.pt"
106-
return torch.load(path.as_posix())
106+
return FileHandler.read_img(path / "cellseg_models_pytorch/inference/tests/data/test1.png")
107+
@pytest.fixture(scope="package")
107108

108109

109-
@pytest.fixture(scope="package")
110-
def img_sample() -> np.ndarray:
110+
def img_sample256() -> np.ndarray:
111111
"""Read in test RGB img."""
112112
path = Path().resolve()
113-
return FileHandler.read_img(path / "cellseg_models_pytorch/utils/tests/data/HE.png")
113+
return FileHandler.read_img(path / "cellseg_models_pytorch/utils/tests/data/imgs/patch2.png")
114114

115115

116116
@pytest.fixture(scope="package")
117117
def hdf5db() -> Path:
118118
"""Read in test RGB img."""
119119
path = Path().resolve()
120-
return path / "cellseg_models_pytorch/datasets/tests/data/tiny_test.h5"
120+
return path / "cellseg_models_pytorch/utils/tests/data/tiny_test.h5"
121121

122122

123123
@pytest.fixture(scope="package")

0 commit comments

Comments
 (0)