summaryrefslogtreecommitdiff
path: root/numpy/testing
diff options
context:
space:
mode:
authorMatthew Brett <matthew.brett@gmail.com>2011-08-15 12:58:03 -0700
committerCharles Harris <charlesr.harris@gmail.com>2011-08-16 10:44:29 -0600
commit316d1f4ec9e033b21062b8f2dcdddeef01d7a889 (patch)
treecfb40a73311530041159483318cb654f190b58b6 /numpy/testing
parent199535c5c34360be7238c80b25d810abce62e6e4 (diff)
downloadnumpy-316d1f4ec9e033b21062b8f2dcdddeef01d7a889.tar.gz
FIX: fix doctest error with empty output
The numpy doctest extension generates an error with empty doctest output; this most often comes about with the +SKIP option. The numpy doctest plugin exposed a nose bug because it accidentally used a different default for the 'doctest-result-variable'. nose bug report here: http://code.google.com/p/python-nose/issues/detail?id=445
Diffstat (limited to 'numpy/testing')
-rw-r--r--numpy/testing/noseclasses.py4
-rw-r--r--numpy/testing/tests/test_doctesting.py18
2 files changed, 21 insertions, 1 deletions
diff --git a/numpy/testing/noseclasses.py b/numpy/testing/noseclasses.py
index 25f6662b7..74b886fed 100644
--- a/numpy/testing/noseclasses.py
+++ b/numpy/testing/noseclasses.py
@@ -196,6 +196,7 @@ class NumpyDoctest(npd.Doctest):
self.doctest_tests = True
self.finder = NumpyDocTestFinder()
self.parser = doctest.DocTestParser()
+ self.doctest_result_var = None # default in npd.Doctest
if self.enabled:
# Pull standard doctest out of plugin list; there's no reason to run
# both. In practice the Unplugger plugin above would cover us when
@@ -254,7 +255,8 @@ class NumpyDoctest(npd.Doctest):
yield NumpyDocTestCase(test,
optionflags=optionflags,
- checker=NumpyOutputChecker())
+ checker=NumpyOutputChecker(),
+ result_var = self.doctest_result_var)
# Add an afterContext method to nose.plugins.doctests.Doctest in order
diff --git a/numpy/testing/tests/test_doctesting.py b/numpy/testing/tests/test_doctesting.py
index a9f790208..a34071128 100644
--- a/numpy/testing/tests/test_doctesting.py
+++ b/numpy/testing/tests/test_doctesting.py
@@ -26,6 +26,24 @@ def check_whitespace_enabled():
7
'''
+def check_empty_output():
+ """ Check that no output does not cause an error.
+
+ This is related to nose bug 445; the numpy plugin changed the
+ doctest-result-variable default and therefore hit this bug:
+ http://code.google.com/p/python-nose/issues/detail?id=445
+
+ >>> a = 10
+ """
+
+def check_skip():
+ """ Check skip directive
+
+ The test below should not run
+
+ >>> 1/0 #doctest: +SKIP
+ """
+
if __name__ == '__main__':
# Run tests outside numpy test rig