Kaydet (Commit) 7c1017bf authored tarafından Andrew Svetlov's avatar Andrew Svetlov

Fix tests for #11798

üst eb973684
...@@ -2290,6 +2290,12 @@ class SkipDocTestCase(DocTestCase): ...@@ -2290,6 +2290,12 @@ class SkipDocTestCase(DocTestCase):
__str__ = shortDescription __str__ = shortDescription
class _DocTestSuite(unittest.TestSuite):
def _removeTestAtIndex(self, index):
pass
def DocTestSuite(module=None, globs=None, extraglobs=None, test_finder=None, def DocTestSuite(module=None, globs=None, extraglobs=None, test_finder=None,
**options): **options):
""" """
...@@ -2335,7 +2341,7 @@ def DocTestSuite(module=None, globs=None, extraglobs=None, test_finder=None, ...@@ -2335,7 +2341,7 @@ def DocTestSuite(module=None, globs=None, extraglobs=None, test_finder=None,
if not tests and sys.flags.optimize >=2: if not tests and sys.flags.optimize >=2:
# Skip doctests when running with -O2 # Skip doctests when running with -O2
suite = unittest.TestSuite() suite = _DocTestSuite()
suite.addTest(SkipDocTestCase(module)) suite.addTest(SkipDocTestCase(module))
return suite return suite
elif not tests: elif not tests:
...@@ -2349,7 +2355,7 @@ def DocTestSuite(module=None, globs=None, extraglobs=None, test_finder=None, ...@@ -2349,7 +2355,7 @@ def DocTestSuite(module=None, globs=None, extraglobs=None, test_finder=None,
raise ValueError(module, "has no docstrings") raise ValueError(module, "has no docstrings")
tests.sort() tests.sort()
suite = unittest.TestSuite() suite = _DocTestSuite()
for test in tests: for test in tests:
if len(test.examples) == 0: if len(test.examples) == 0:
...@@ -2459,7 +2465,7 @@ def DocFileSuite(*paths, **kw): ...@@ -2459,7 +2465,7 @@ def DocFileSuite(*paths, **kw):
encoding encoding
An encoding that will be used to convert the files to unicode. 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 # We do this here so that _normalize_module is called at the right
# level. If it were called in DocFileTest, then this function # level. If it were called in DocFileTest, then this function
......
...@@ -142,7 +142,7 @@ class PyclbrTest(TestCase): ...@@ -142,7 +142,7 @@ class PyclbrTest(TestCase):
self.checkModule('pyclbr') self.checkModule('pyclbr')
self.checkModule('ast') self.checkModule('ast')
self.checkModule('doctest', ignore=("TestResults", "_SpoofOut", self.checkModule('doctest', ignore=("TestResults", "_SpoofOut",
"DocTestCase")) "DocTestCase", '_DocTestSuite'))
self.checkModule('difflib', ignore=("Match",)) self.checkModule('difflib', ignore=("Match",))
def test_decorators(self): def test_decorators(self):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment