Commits

Anonymous committed 4e2b860

Improvement to fix for issue 9926 to allow TestResult to be reused.

Comments (0)

Files changed (2)

Lib/unittest/suite.py

         if topLevel:
             self._tearDownPreviousClass(None, result)
             self._handleModuleTearDown(result)
+            result._testRunEntered = False
         return result
 
     def debug(self):

Lib/unittest/test/test_suite.py

                 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()