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

This commit is contained in:
Michael Foord 2010-12-19 14:12:23 +00:00
parent 62a1aaeeac
commit 5657ff8aa0
2 changed files with 6 additions and 1 deletions

View 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):

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