Skip to content

MAINT: avoid deprecation warnings #2903

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions nipype/algorithms/tests/test_CompCor.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,15 @@ def test_compcor_bad_input_shapes(self):
data_file = utils.save_toy_nii(np.zeros(data_shape), 'temp.nii')
interface = CompCor(
realigned_file=data_file, mask_files=self.mask_files[0])
with pytest.raises(ValueError, message="Dimension mismatch"):
interface.run()
with pytest.raises(ValueError):
interface.run() # Dimension mismatch

def test_tcompcor_bad_input_dim(self):
bad_dims = (2, 2, 2)
data_file = utils.save_toy_nii(np.zeros(bad_dims), 'temp.nii')
interface = TCompCor(realigned_file=data_file)
with pytest.raises(ValueError, message='Not a 4D file'):
interface.run()
with pytest.raises(ValueError):
interface.run() # Not a 4D file

def test_tcompcor_merge_intersect_masks(self):
for method in ['union', 'intersect']:
Expand Down Expand Up @@ -145,8 +145,8 @@ def test_tcompcor_index_mask(self):
def test_tcompcor_multi_mask_no_index(self):
interface = TCompCor(
realigned_file=self.realigned_file, mask_files=self.mask_files)
with pytest.raises(ValueError, message='more than one mask file'):
interface.run()
with pytest.raises(ValueError):
interface.run() # more than one mask file

def run_cc(self,
ccinterface,
Expand Down
7 changes: 5 additions & 2 deletions nipype/interfaces/dipy/tracks.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,16 @@
if HAVE_DIPY and LooseVersion(dipy_version()) >= LooseVersion('0.15'):

from dipy.workflows.segment import RecoBundlesFlow, LabelsBundlesFlow
from dipy.workflows.tracking import DetTrackPAMFlow
try:
from dipy.workflows.tracking import LocalFiberTrackingPAMFlow as DetTrackFlow
except ImportError: # different name in 0.15
from dipy.workflows.tracking import DetTrackPAMFlow as DetTrackFlow

RecoBundles = dipy_to_nipype_interface("RecoBundles", RecoBundlesFlow)
LabelsBundles = dipy_to_nipype_interface("LabelsBundles",
LabelsBundlesFlow)
DeterministicTracking = dipy_to_nipype_interface("DeterministicTracking",
DetTrackPAMFlow)
DetTrackFlow)

else:
IFLOGGER.info("We advise you to upgrade DIPY version. This upgrade will"
Expand Down
4 changes: 2 additions & 2 deletions nipype/testing/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
template = funcfile
transfm = funcfile

from . import decorators as dec
from . import decorators
from .utils import package_check, TempFATFS

skipif = dec.skipif
skipif = decorators.dec.skipif


def example_data(infile='functional.nii'):
Expand Down
9 changes: 4 additions & 5 deletions nipype/testing/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
"""
Extend numpy's decorators to use nipype's gui and data labels.
"""

from numpy.testing.decorators import knownfailureif, skipif
from numpy.testing import dec

from nibabel.data import DataError

Expand Down Expand Up @@ -81,19 +80,19 @@ def needs_review(msg):
"""

def skip_func(func):
return skipif(True, msg)(func)
return dec.skipif(True, msg)(func)

return skip_func


# Easier version of the numpy knownfailure
def knownfailure(f):
return knownfailureif(True)(f)
return dec.knownfailureif(True)(f)


def if_datasource(ds, msg):
try:
ds.get_filename()
except DataError:
return skipif(True, msg)
return dec.skipif(True, msg)
return lambda f: f