Skip to content

Commit 937cd9d

Browse files
committed
FIX: Ensure nose can be imported during mock test
1 parent 8190044 commit 937cd9d

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

nibabel/tests/test_optpkg.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,12 @@ def test_basic():
3838
assert_good('os.path')
3939
# We never have package _not_a_package
4040
assert_bad('_not_a_package')
41+
42+
# setup_module imports nose, so make sure we don't disrupt that
43+
orig_import = builtins.__import__
4144
def raise_Exception(*args, **kwargs):
45+
if args[0] == 'nose':
46+
return orig_import(*args, **kwargs)
4247
raise Exception(
4348
"non ImportError could be thrown by some malfunctioning module "
4449
"upon import, and optional_package should catch it too")

0 commit comments

Comments
 (0)