Skip to content

Commit 4f7d3d5

Browse files
authored
Merge pull request #738 from yarikoptic/enh-deprec-numpy.testing.decorators
RF: Centralize import of decorators from numpy.testing
2 parents 753f89d + c053e41 commit 4f7d3d5

File tree

6 files changed

+8
-17
lines changed

6 files changed

+8
-17
lines changed

nibabel/nicom/tests/test_csareader.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
from nose.tools import (assert_true, assert_false, assert_equal, assert_raises)
1414

15-
from numpy.testing.decorators import skipif
15+
from ...testing import skipif
1616

1717
from nibabel.pydicom_compat import dicom_test, pydicom
1818
from .test_dicomwrappers import (IO_DATA_PATH, DATA)

nibabel/testing/__init__.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,10 @@
1717

1818
import numpy as np
1919
from numpy.testing import assert_array_equal
20+
from numpy.testing import dec
21+
skipif = dec.skipif
22+
slow = dec.slow
2023

21-
try:
22-
from numpy.testing import dec
23-
skipif = dec.skipif
24-
except ImportError:
25-
from numpy.testing.decorators import skipif
2624
# Allow failed import of nose if not now running tests
2725
try:
2826
from nose.tools import (assert_equal, assert_not_equal,

nibabel/tests/nibabel_data.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from os import environ, listdir
55
from os.path import dirname, realpath, join as pjoin, isdir, exists
66

7-
from numpy.testing.decorators import skipif
7+
from ..testing import skipif
88

99

1010
def get_nibabel_data():

nibabel/tests/test_processing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
from numpy.testing import (assert_almost_equal,
3232
assert_array_equal)
33-
from numpy.testing.decorators import skipif
33+
from ..testing import skipif
3434

3535
from nose.tools import (assert_true, assert_false, assert_raises,
3636
assert_equal, assert_not_equal)

nibabel/tests/test_quaternions.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,7 @@
1111
import numpy as np
1212
from numpy import pi
1313

14-
# Recent (1.2) versions of numpy have this decorator
15-
try:
16-
from numpy.testing.decorators import slow
17-
except ImportError:
18-
def slow(t):
19-
t.slow = True
20-
return t
21-
14+
from ..testing import slow
2215
from nose.tools import assert_raises, assert_true, assert_false, \
2316
assert_equal
2417

nibabel/tests/test_viewers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from ..optpkg import optional_package
1515
from ..viewers import OrthoSlicer3D
1616

17-
from numpy.testing.decorators import skipif
17+
from ..testing import skipif
1818
from numpy.testing import assert_array_equal, assert_equal
1919

2020
from nose.tools import assert_raises, assert_true

0 commit comments

Comments
 (0)