]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Improvement to fix for issue 9926 to allow TestResult to be reused.
authorMichael Foord <fuzzyman@voidspace.org.uk>
Sun, 19 Dec 2010 14:12:23 +0000 (14:12 +0000)
committerMichael Foord <fuzzyman@voidspace.org.uk>
Sun, 19 Dec 2010 14:12:23 +0000 (14:12 +0000)
Lib/unittest/suite.py
Lib/unittest/test/test_suite.py

index e8fbdc31fed7091711414525dcbd593376dd6de6..c0ae2aeeb66f8080945f7a537a37f655f09bf54b 100644 (file)
@@ -107,6 +107,7 @@ class TestSuite(BaseTestSuite):
         if topLevel:
             self._tearDownPreviousClass(None, result)
             self._handleModuleTearDown(result)
+            result._testRunEntered = False
         return result
 
     def debug(self):
index d212bd05dc4e6ab8c1b139329f2e541c7e815b5c..72fb527a68537f5846927674105db4d696dd8e05 100644 (file)
@@ -353,11 +353,15 @@ class Test_TestSuite(unittest.TestCase, TestEquality):
                 unittest.TestSuite.__call__(self, *args, **kw)
 
         suite = MySuite()
+        result = unittest.TestResult()
         wrapper = unittest.TestSuite()
         wrapper.addTest(suite)
-        wrapper(unittest.TestResult())
+        wrapper(result)
         self.assertTrue(suite.called)
 
+        # reusing results should be permitted even if abominable
+        self.assertFalse(result._testRunEntered)
+
 
 if __name__ == '__main__':
     unittest.main()