Skip to content

Commit 7269ff0

Browse files
committed
maint: avoid deprecation warnings
1 parent 232ac23 commit 7269ff0

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

nipype/algorithms/tests/test_CompCor.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,15 +108,17 @@ def test_compcor_bad_input_shapes(self):
108108
data_file = utils.save_toy_nii(np.zeros(data_shape), 'temp.nii')
109109
interface = CompCor(
110110
realigned_file=data_file, mask_files=self.mask_files[0])
111-
with pytest.raises(ValueError, message="Dimension mismatch"):
111+
with pytest.raises(ValueError):
112112
interface.run()
113+
pytest.fail("Dimension mismatch")
113114

114115
def test_tcompcor_bad_input_dim(self):
115116
bad_dims = (2, 2, 2)
116117
data_file = utils.save_toy_nii(np.zeros(bad_dims), 'temp.nii')
117118
interface = TCompCor(realigned_file=data_file)
118-
with pytest.raises(ValueError, message='Not a 4D file'):
119+
with pytest.raises(ValueError):
119120
interface.run()
121+
pytest.fail("Not a 4D file")
120122

121123
def test_tcompcor_merge_intersect_masks(self):
122124
for method in ['union', 'intersect']:
@@ -145,8 +147,9 @@ def test_tcompcor_index_mask(self):
145147
def test_tcompcor_multi_mask_no_index(self):
146148
interface = TCompCor(
147149
realigned_file=self.realigned_file, mask_files=self.mask_files)
148-
with pytest.raises(ValueError, message='more than one mask file'):
150+
with pytest.raises(ValueError):
149151
interface.run()
152+
pytest.fail("more than one mask file")
150153

151154
def run_cc(self,
152155
ccinterface,

nipype/testing/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616
template = funcfile
1717
transfm = funcfile
1818

19-
from . import decorators as dec
19+
from . import decorators
2020
from .utils import package_check, TempFATFS
2121

22-
skipif = dec.skipif
22+
skipif = decorators.dec.skipif
2323

2424

2525
def example_data(infile='functional.nii'):

nipype/testing/decorators.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
"""
55
Extend numpy's decorators to use nipype's gui and data labels.
66
"""
7-
8-
from numpy.testing.decorators import knownfailureif, skipif
7+
from numpy.testing import dec
98

109
from nibabel.data import DataError
1110

@@ -81,19 +80,19 @@ def needs_review(msg):
8180
"""
8281

8382
def skip_func(func):
84-
return skipif(True, msg)(func)
83+
return dec.skipif(True, msg)(func)
8584

8685
return skip_func
8786

8887

8988
# Easier version of the numpy knownfailure
9089
def knownfailure(f):
91-
return knownfailureif(True)(f)
90+
return dec.knownfailureif(True)(f)
9291

9392

9493
def if_datasource(ds, msg):
9594
try:
9695
ds.get_filename()
9796
except DataError:
98-
return skipif(True, msg)
97+
return dec.skipif(True, msg)
9998
return lambda f: f

0 commit comments

Comments
 (0)