Skip to content

Commit 305bd21

Browse files
committed
Skip tests with missing optional dependencies
1 parent 2e32124 commit 305bd21

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

pysteps/tests/test_motion.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,8 @@ def test_optflow_method_convergence(input_precip, optflow_method_name,
194194
- linear_x: (u=2, v=0)
195195
- linear_y: (u=0, v=2)
196196
"""
197+
if optflow_method_name == 'lk':
198+
pytest.importorskip('cv2')
197199

198200
ideal_motion, precip_obs = _create_observations(input_precip.copy(),
199201
motion_type,
@@ -264,6 +266,8 @@ def test_no_precipitation(optflow_method_name, num_times):
264266
Number of precipitation frames (times) used as input for the optical
265267
flow methods.
266268
"""
269+
if optflow_method_name == 'lk':
270+
pytest.importorskip('cv2')
267271
zero_precip = np.zeros((num_times,) + reference_field.shape)
268272
motion_method = motion.get_method(optflow_method_name)
269273
uv_motion = motion_method(zero_precip, verbose=False)
@@ -286,6 +290,8 @@ def test_no_precipitation(optflow_method_name, num_times):
286290
def test_input_shape_checks(optflow_method_name,
287291
minimum_input_frames,
288292
maximum_input_frames):
293+
if optflow_method_name == 'lk':
294+
pytest.importorskip('cv2')
289295
image_size = 100
290296
motion_method = motion.get_method(optflow_method_name)
291297

pysteps/tests/test_nowcasts_steps.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ def test_steps(
4646
upscale=2000)[1:, :, :]
4747

4848
# Retrieve motion field
49+
pytest.importorskip('cv2')
4950
oflow_method = motion.get_method("LK")
5051
retrieved_motion = oflow_method(precip_input)
5152

0 commit comments

Comments
 (0)