Skip to content

Commit f5a4c35

Browse files
committed
✅ Update tests to use track_tmp_path for clean up
1 parent 050986f commit f5a4c35

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

tests/models/test_dataset.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,9 @@ def test_patch_dataset_path_imgs(
145145
assert sampled_img_shape[2] == size[2]
146146

147147

148-
def test_patch_dataset_list_imgs(tmp_path: Path) -> None:
148+
def test_patch_dataset_list_imgs(track_tmp_path: Path) -> None:
149149
"""Test for patch dataset with a list of images as input."""
150-
save_dir_path = tmp_path
150+
save_dir_path = track_tmp_path
151151

152152
size = (5, 5, 3)
153153
img = RNG.integers(low=0, high=255, size=size)
@@ -212,10 +212,10 @@ def test_patch_datasetarray_imgs() -> None:
212212
assert sampled_img_shape[2] == size[2]
213213

214214

215-
def test_patch_dataset_crash(tmp_path: Path) -> None:
215+
def test_patch_dataset_crash(track_tmp_path: Path) -> None:
216216
"""Test to make sure patch dataset crashes with incorrect input."""
217217
# all below examples should fail when input to PatchDataset
218-
save_dir_path = tmp_path
218+
save_dir_path = track_tmp_path
219219

220220
# not supported input type
221221
imgs = {"a": RNG.integers(0, 255, (4, 4, 4))}
@@ -324,7 +324,7 @@ def test_patch_dataset_crash(tmp_path: Path) -> None:
324324

325325
def test_wsi_patch_dataset( # noqa: PLR0915
326326
sample_wsi_dict: dict,
327-
tmp_path: Path,
327+
track_tmp_path: Path,
328328
) -> None:
329329
"""A test for creation and bare output."""
330330
# convert to pathlib Path to prevent wsireader complaint
@@ -477,7 +477,7 @@ def __getitem__(self: Proto, idx: int) -> object:
477477
)
478478
negative_mask = imread(mini_wsi_msk)
479479
negative_mask = np.zeros_like(negative_mask)
480-
negative_mask_path = tmp_path / "negative_mask.png"
480+
negative_mask_path = track_tmp_path / "negative_mask.png"
481481
imwrite(negative_mask_path, negative_mask)
482482
with pytest.raises(ValueError, match="No patch coordinates remain after filtering"):
483483
ds = WSIPatchDataset(

0 commit comments

Comments
 (0)