Skip to content

Commit b608ad5

Browse files
committed
TST: wrap skipifs in pytest.param, closes #1460
1 parent 6e74c33 commit b608ad5

1 file changed

Lines changed: 32 additions & 15 deletions

File tree

odl/util/testutils.py

Lines changed: 32 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import sys
1616
import warnings
1717
from builtins import object
18+
from functools import partial
1819
from time import time
1920

2021
import numpy as np
@@ -199,28 +200,44 @@ def _pass(function):
199200
skip_if_no_benchmark = _pass
200201
else:
201202
# Used in lists where the elements should all be skipifs
202-
never_skip = pytest.mark.skipif(
203-
"False",
204-
reason='Fill in, never skips'
203+
never_skip = partial(
204+
pytest.param,
205+
marks=pytest.mark.skipif(
206+
'False',
207+
reason='',
208+
)
205209
)
206210

207-
skip_if_no_pywavelets = pytest.mark.skipif(
208-
"not odl.trafos.PYWT_AVAILABLE",
209-
reason='PyWavelets not available'
211+
skip_if_no_pywavelets = partial(
212+
pytest.param,
213+
marks=pytest.mark.skipif(
214+
'not odl.trafos.PYWT_AVAILABLE',
215+
reason='PyWavelets not available',
216+
)
210217
)
211218

212-
skip_if_no_pyfftw = pytest.mark.skipif(
213-
"not odl.trafos.PYFFTW_AVAILABLE",
214-
reason='pyFFTW not available')
219+
skip_if_no_pyfftw = partial(
220+
pytest.param,
221+
marks=pytest.mark.skipif(
222+
'not odl.trafos.PYFFTW_AVAILABLE',
223+
reason='pyFFTW not available',
224+
)
225+
)
215226

216-
skip_if_no_largescale = pytest.mark.skipif(
217-
"not pytest.config.getoption('--largescale')",
218-
reason='Need --largescale option to run'
227+
skip_if_no_largescale = partial(
228+
pytest.param,
229+
marks=pytest.mark.skipif(
230+
"not pytest.config.getoption('--largescale')",
231+
reason='Need --largescale option to run',
232+
)
219233
)
220234

221-
skip_if_no_benchmark = pytest.mark.skipif(
222-
"not pytest.config.getoption('--benchmark')",
223-
reason='Need --benchmark option to run'
235+
skip_if_no_benchmark = partial(
236+
pytest.param,
237+
marks=pytest.mark.skipif(
238+
"not pytest.config.getoption('--benchmark')",
239+
reason='Need --benchmark option to run',
240+
)
224241
)
225242

226243

0 commit comments

Comments
 (0)