summaryrefslogtreecommitdiff
path: root/numpy/testing/numpytest.py
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/testing/numpytest.py')
-rw-r--r--numpy/testing/numpytest.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/numpy/testing/numpytest.py b/numpy/testing/numpytest.py
index 211a1b581..eac58551b 100644
--- a/numpy/testing/numpytest.py
+++ b/numpy/testing/numpytest.py
@@ -176,7 +176,12 @@ class NumpyTestCase (unittest.TestCase):
f = get_frame(1)
filename = f.f_globals['__file__']
name = os.path.splitext(os.path.basename(filename))[0]
- m = imp.load_module(name, open(filename), filename,('.py','U',1))
+ path = [os.path.dirname(filename)]
+ file, pathname, description = imp.find_module(name, path)
+ try:
+ m = imp.load_module(name, file, pathname, description)
+ finally:
+ file.close()
tests = doctest.DocTestFinder().find(m)
runner = doctest.DocTestRunner(verbose=False)
for test in tests: