Skip to content

RF: Centralize import of decorators from numpy.testing #738

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 13, 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
2 changes: 1 addition & 1 deletion nibabel/nicom/tests/test_csareader.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

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

from numpy.testing.decorators import skipif
from ...testing import skipif

from nibabel.pydicom_compat import dicom_test, pydicom
from .test_dicomwrappers import (IO_DATA_PATH, DATA)
Expand Down
8 changes: 3 additions & 5 deletions nibabel/testing/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,10 @@

import numpy as np
from numpy.testing import assert_array_equal
from numpy.testing import dec
skipif = dec.skipif
slow = dec.slow

try:
from numpy.testing import dec
skipif = dec.skipif
except ImportError:
from numpy.testing.decorators import skipif
# Allow failed import of nose if not now running tests
try:
from nose.tools import (assert_equal, assert_not_equal,
Expand Down
2 changes: 1 addition & 1 deletion nibabel/tests/nibabel_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from os import environ, listdir
from os.path import dirname, realpath, join as pjoin, isdir, exists

from numpy.testing.decorators import skipif
from ..testing import skipif


def get_nibabel_data():
Expand Down
2 changes: 1 addition & 1 deletion nibabel/tests/test_processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

from numpy.testing import (assert_almost_equal,
assert_array_equal)
from numpy.testing.decorators import skipif
from ..testing import skipif

from nose.tools import (assert_true, assert_false, assert_raises,
assert_equal, assert_not_equal)
Expand Down
9 changes: 1 addition & 8 deletions nibabel/tests/test_quaternions.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,7 @@
import numpy as np
from numpy import pi

# Recent (1.2) versions of numpy have this decorator
try:
from numpy.testing.decorators import slow
except ImportError:
def slow(t):
t.slow = True
return t

from ..testing import slow
from nose.tools import assert_raises, assert_true, assert_false, \
assert_equal

Expand Down
2 changes: 1 addition & 1 deletion nibabel/tests/test_viewers.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from ..optpkg import optional_package
from ..viewers import OrthoSlicer3D

from numpy.testing.decorators import skipif
from ..testing import skipif
from numpy.testing import assert_array_equal, assert_equal

from nose.tools import assert_raises, assert_true
Expand Down