summaryrefslogtreecommitdiff
path: root/numpy/testing/numpytest.py
diff options
context:
space:
mode:
authorTim Hochberg <tim_hochberg@local>2006-04-30 21:46:36 +0000
committerTim Hochberg <tim_hochberg@local>2006-04-30 21:46:36 +0000
commitab513918819e227187168222ca8a81dc996d89ca (patch)
tree00a4a98444ef4b1edb5937a17c3f3784e9846137 /numpy/testing/numpytest.py
parentb3bf22851ebe0096dcf504f9576ce6d14ff42817 (diff)
downloadnumpy-ab513918819e227187168222ca8a81dc996d89ca.tar.gz
Changed rundocs to closely follow procedure outlined in the docs for imp.load_module. This fixed a bizzare error where tests would run fine the first time through, but would fail the second time through when loading from a pyc file.
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: