Skip to content

Commit d404817

Browse files
Merge pull request #1 from matthew-brett/check-mock-for-tests
RF: check for "mock' module when running tests
2 parents 7305e34 + e8a7272 commit d404817

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

nibabel/__init__.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,16 +67,17 @@
6767
from . import streamlines
6868
from . import viewers
6969

70-
# be friendly on systems with ancient numpy -- no tests, but at least
71-
# importable
70+
# Note test requirement for "mock". Requirement for "nose" tested by numpy.
7271
try:
72+
import mock
73+
except ImportError:
74+
def test(*args, **kwargs):
75+
raise RuntimeError('Need "mock" package for tests')
76+
else:
7377
from numpy.testing import Tester
7478
test = Tester().test
7579
bench = Tester().bench
76-
del Tester
77-
except ImportError:
78-
def test(*args, **kwargs):
79-
raise RuntimeError('Need numpy >= 1.2 for tests')
80+
del mock, Tester
8081

8182
from .pkg_info import get_pkg_info as _get_pkg_info
8283

0 commit comments

Comments
 (0)