Skip to content

Commit 6261f60

Browse files
committed
Skip test if an optional dependency is not installed
1 parent 6d39925 commit 6261f60

File tree

5 files changed

+14
-2
lines changed

5 files changed

+14
-2
lines changed

pysteps/tests/test_blending_steps.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ def test_steps_blending(
5050
decomposed_nwp,
5151
expected_n_ens_members,
5252
):
53+
pytest.importorskip("cv2")
54+
5355
###
5456
# The input data
5557
###

pysteps/tests/test_feature.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99

1010
@pytest.mark.parametrize(arg_names, arg_values)
1111
def test_feature(method, max_num_features):
12+
if method == "blob":
13+
pytest.importorskip("skimage")
14+
if method == "shitomasi":
15+
pytest.importorskip("cv2")
16+
1217
input_field, _ = get_precipitation_fields(0, 0, True, True, None, "mch")
1318

1419
detector = feature.get_method(method)

pysteps/tests/test_nowcasts_lagrangian_probability.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ def test_numerical_example():
3434

3535
def test_real_case():
3636
""""""
37+
pytest.importorskip("cv2")
38+
3739
# inputs
3840
precip, metadata = get_precipitation_fields(
3941
num_prev_files=2,

pysteps/tests/test_nowcasts_steps.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,9 @@ def test_steps_skill(
9494

9595
def test_steps_callback(tmp_path):
9696
"""Test STEPS callback functionality to export the output as a netcdf."""
97+
98+
pytest.importorskip("netCDF4")
99+
97100
n_ens_members = 2
98101
n_timesteps = 3
99102

pysteps/tests/test_plt_motionfields.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
def test_visualization_motionfields_quiver(
3232
source, axis, step, quiver_kwargs, map_kwargs, upscale, pass_geodata
3333
):
34-
34+
pytest.importorskip("cv2")
3535
if source is not None:
3636
fields, geodata = get_precipitation_fields(0, 2, False, True, upscale, source)
3737
if not pass_geodata:
@@ -76,7 +76,7 @@ def test_visualization_motionfields_quiver(
7676
def test_visualization_motionfields_streamplot(
7777
source, axis, streamplot_kwargs, map_kwargs, upscale, pass_geodata
7878
):
79-
79+
pytest.importorskip("cv2")
8080
if source is not None:
8181
fields, geodata = get_precipitation_fields(0, 2, False, True, upscale, source)
8282
if not pass_geodata:

0 commit comments

Comments
 (0)