Skip to content

Commit 5d7cc1b

Browse files
mihmatthew-brett
authored andcommitted
Allow nibabel to be imported with ancient numpy.
1 parent ad9ec16 commit 5d7cc1b

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

nibabel/__init__.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,14 @@
5656
from .imageclasses import class_map, ext_map
5757
from . import trackvis
5858

59-
from numpy.testing import Tester
60-
test = Tester().test
61-
del Tester
59+
# be friendly on systems with ancient numpy -- no tests, but at least
60+
# importable
61+
try:
62+
from numpy.testing import Tester
63+
test = Tester().test
64+
del Tester
65+
except ImportError:
66+
def test(*args, **kwargs): raise RuntimeError('Need numpy >= 1.2 for tests')
6267

6368
from .pkg_info import get_pkg_info as _get_pkg_info
6469
get_info = lambda : _get_pkg_info(os.path.dirname(__file__))

0 commit comments

Comments
 (0)