summaryrefslogtreecommitdiff
path: root/scipy/test/testing.py
diff options
context:
space:
mode:
authorcookedm <cookedm@localhost>2005-10-30 23:11:41 +0000
committercookedm <cookedm@localhost>2005-10-30 23:11:41 +0000
commit9362a1d8d498985e41a35c089fc68cd280a0fde9 (patch)
tree205816b602e8363bac8c00c26a8667e2767030ba /scipy/test/testing.py
parentcf44e43dd744f2a55ed90b253747499fef141dbc (diff)
downloadnumpy-9362a1d8d498985e41a35c089fc68cd280a0fde9.tar.gz
Save and restore sys.displayhook around running tests, so that doctests can
run correctly under IPython
Diffstat (limited to 'scipy/test/testing.py')
-rw-r--r--scipy/test/testing.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/scipy/test/testing.py b/scipy/test/testing.py
index aad87cc88..0c01ab51f 100644
--- a/scipy/test/testing.py
+++ b/scipy/test/testing.py
@@ -367,7 +367,15 @@ class ScipyTest:
all_tests = unittest.TestSuite(suites)
runner = unittest.TextTestRunner(verbosity=verbosity)
- runner.run(all_tests)
+ # Use the builtin displayhook. If the tests are being run
+ # under IPython (for instance), any doctest test suites will
+ # fail otherwise.
+ old_displayhook = sys.displayhook
+ sys.displayhook = sys.__displayhook__
+ try:
+ runner.run(all_tests)
+ finally:
+ sys.displayhook = old_displayhook
return runner
def run(self):