[Python-checkins] cpython: Fix tests for #11798

andrew.svetlov python-checkins at python.org
Thu Aug 29 00:25:06 CEST 2013


http://hg.python.org/cpython/rev/17f23cf029cf
changeset:   85436:17f23cf029cf
user:        Andrew Svetlov <andrew.svetlov at gmail.com>
date:        Thu Aug 29 01:24:39 2013 +0300
summary:
  Fix tests for #11798

files:
  Lib/doctest.py          |  12 +++++++++---
  Lib/test/test_pyclbr.py |   2 +-
  2 files changed, 10 insertions(+), 4 deletions(-)


diff --git a/Lib/doctest.py b/Lib/doctest.py
--- a/Lib/doctest.py
+++ b/Lib/doctest.py
@@ -2290,6 +2290,12 @@
     __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 @@
 
     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 @@
         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 @@
     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
diff --git a/Lib/test/test_pyclbr.py b/Lib/test/test_pyclbr.py
--- a/Lib/test/test_pyclbr.py
+++ b/Lib/test/test_pyclbr.py
@@ -142,7 +142,7 @@
         self.checkModule('pyclbr')
         self.checkModule('ast')
         self.checkModule('doctest', ignore=("TestResults", "_SpoofOut",
-                                            "DocTestCase"))
+                                            "DocTestCase", '_DocTestSuite'))
         self.checkModule('difflib', ignore=("Match",))
 
     def test_decorators(self):

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list