summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorR David Murray <rdmurray@bitdance.com>2012-03-21 18:55:04 (GMT)
committerR David Murray <rdmurray@bitdance.com>2012-03-21 18:55:04 (GMT)
commit1da08e77dff8ba59c87e8f0473a00f7df21a806f (patch)
tree80eb6c9e11e1a158bbfa254243c5e1aac97d41fe /Lib
parent520e8508a005252fbe0742458bc894475bbb195a (diff)
parente112153727def076478a84733f30a8f44f4c8844 (diff)
downloadcpython-1da08e77dff8ba59c87e8f0473a00f7df21a806f.zip
cpython-1da08e77dff8ba59c87e8f0473a00f7df21a806f.tar.gz
cpython-1da08e77dff8ba59c87e8f0473a00f7df21a806f.tar.bz2
Merge #12757: Make doctest skipping in -OO mode work with unittest/regrtest -v
Diffstat (limited to 'Lib')
-rw-r--r--Lib/doctest.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/Lib/doctest.py b/Lib/doctest.py
index aba98dc..620451f 100644
--- a/Lib/doctest.py
+++ b/Lib/doctest.py
@@ -2267,7 +2267,8 @@ class DocTestCase(unittest.TestCase):
return "Doctest: " + self._dt_test.name
class SkipDocTestCase(DocTestCase):
- def __init__(self):
+ def __init__(self, module):
+ self.module = module
DocTestCase.__init__(self, None)
def setUp(self):
@@ -2277,7 +2278,10 @@ class SkipDocTestCase(DocTestCase):
pass
def shortDescription(self):
- return "Skipping tests from %s" % module.__name__
+ return "Skipping tests from %s" % self.module.__name__
+
+ __str__ = shortDescription
+
def DocTestSuite(module=None, globs=None, extraglobs=None, test_finder=None,
**options):
@@ -2325,7 +2329,7 @@ def DocTestSuite(module=None, globs=None, extraglobs=None, test_finder=None,
if not tests and sys.flags.optimize >=2:
# Skip doctests when running with -O2
suite = unittest.TestSuite()
- suite.addTest(SkipDocTestCase())
+ suite.addTest(SkipDocTestCase(module))
return suite
elif not tests:
# Why do we want to do this? Because it reveals a bug that might