Fix tests for #11798

This commit is contained in:
Andrew Svetlov 2013-08-29 01:24:39 +03:00
parent eb97368451
commit 7c1017bfee
2 changed files with 10 additions and 4 deletions

View file

@ -2290,6 +2290,12 @@ def shortDescription(self):
__str__ = shortDescription
class _DocTestSuite(unittest.TestSuite):
def _removeTestAtIndex(self, index):
pass
def DocTestSuite(module=None, globs=None, extraglobs=None, test_finder=None,
**options):
"""
@ -2335,7 +2341,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 = _DocTestSuite()
suite.addTest(SkipDocTestCase(module))
return suite
elif not tests:
@ -2349,7 +2355,7 @@ def DocTestSuite(module=None, globs=None, extraglobs=None, test_finder=None,
raise ValueError(module, "has no docstrings")
tests.sort()
suite = unittest.TestSuite()
suite = _DocTestSuite()
for test in tests:
if len(test.examples) == 0:
@ -2459,7 +2465,7 @@ def DocFileSuite(*paths, **kw):
encoding
An encoding that will be used to convert the files to unicode.
"""
suite = unittest.TestSuite()
suite = _DocTestSuite()
# We do this here so that _normalize_module is called at the right
# level. If it were called in DocFileTest, then this function

View file

@ -142,7 +142,7 @@ def test_easy(self):
self.checkModule('pyclbr')
self.checkModule('ast')
self.checkModule('doctest', ignore=("TestResults", "_SpoofOut",
"DocTestCase"))
"DocTestCase", '_DocTestSuite'))
self.checkModule('difflib', ignore=("Match",))
def test_decorators(self):