Skip to content

Commit d928071

Browse files
committed
Skip lexcube viz tests when optional dependency import fails
1 parent 3888e9c commit d928071

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

tests/test_lexcube_viz.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,13 @@
66
import pytest
77
import xarray as xr
88

9-
pytest.importorskip("lexcube", reason="lexcube is required for these visualization tests")
9+
try:
10+
import lexcube # noqa: F401
11+
except Exception as exc: # pragma: no cover - environment-dependent optional dependency
12+
pytest.skip(
13+
f"lexcube is required for these visualization tests (import failed: {exc})",
14+
allow_module_level=True,
15+
)
1016

1117
from cubedynamics.viz.lexcube_viz import show_cube_lexcube
1218

0 commit comments

Comments
 (0)