Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

skip openslide/tiffslide tests if those backends not available #180

Merged
merged 1 commit into from
Aug 8, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 37 additions & 3 deletions tests/test_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
from wsinfer.modellib.models import get_pretrained_torch_module
from wsinfer.modellib.models import get_registered_model
from wsinfer.modellib.run_inference import jit_compile
from wsinfer.wsi import HAS_OPENSLIDE
from wsinfer.wsi import HAS_TIFFSLIDE


@pytest.fixture
Expand Down Expand Up @@ -58,7 +60,23 @@ def tiff_image(tmp_path: Path) -> Path:
],
)
@pytest.mark.parametrize("speedup", [False, True])
@pytest.mark.parametrize("backend", ["openslide", "tiffslide"])
@pytest.mark.parametrize(
"backend",
[
pytest.param(
"openslide",
marks=pytest.mark.skipif(
not HAS_OPENSLIDE, reason="OpenSlide not available"
),
),
pytest.param(
"tiffslide",
marks=pytest.mark.skipif(
not HAS_TIFFSLIDE, reason="TiffSlide not available"
),
),
],
)
def test_cli_run_with_registered_models(
model: str,
speedup: bool,
Expand Down Expand Up @@ -199,7 +217,7 @@ def test_cli_run_with_local_model(tmp_path: Path, tiff_image: Path):
cli,
[
"--backend",
"openslide",
"tiffslide",
"run",
"--wsi-dir",
str(tiff_image.parent),
Expand Down Expand Up @@ -291,7 +309,23 @@ def test_convert_to_sbu():
["patch_size", "patch_spacing"],
[(256, 0.25), (256, 0.50), (350, 0.25), (100, 0.3), (100, 0.5)],
)
@pytest.mark.parametrize("backend", ["openslide", "tiffslide"])
@pytest.mark.parametrize(
"backend",
[
pytest.param(
"openslide",
marks=pytest.mark.skipif(
not HAS_OPENSLIDE, reason="OpenSlide not available"
),
),
pytest.param(
"tiffslide",
marks=pytest.mark.skipif(
not HAS_TIFFSLIDE, reason="TiffSlide not available"
),
),
],
)
def test_patch_cli(
patch_size: int,
patch_spacing: float,
Expand Down