]> 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 04:07:28 +0000 (04:07 +0000)
committerMichael Foord <fuzzyman@voidspace.org.uk>
Sun, 19 Dec 2010 04:07:28 +0000 (04:07 +0000)
Lib/unittest/suite.py
Lib/unittest/test/test_suite.py

index 73f0e17f8a661f9c55ab3675e12c18eab24d0de1..77ce089187305b74630d40b7a0ce75e80ae54aa0 100644 (file)
@@ -104,6 +104,7 @@ class TestSuite(BaseTestSuite):
         if topLevel:
             self._tearDownPreviousClass(None, result)
             self._handleModuleTearDown(result)
+            result._testRunEntered = False
         return result
 
     def debug(self):
index fa32247013f39dacf2728e3ee97463d9c768121a..2db978ddb8a9a21a1f6a9c2f4a3e46e3a10755c9 100644 (file)
@@ -353,11 +353,16 @@ 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()