Commit cca5be2e authored by Michael Foord's avatar Michael Foord

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

parent f100dbd6
...@@ -104,6 +104,7 @@ class TestSuite(BaseTestSuite): ...@@ -104,6 +104,7 @@ class TestSuite(BaseTestSuite):
if topLevel: if topLevel:
self._tearDownPreviousClass(None, result) self._tearDownPreviousClass(None, result)
self._handleModuleTearDown(result) self._handleModuleTearDown(result)
result._testRunEntered = False
return result return result
def debug(self): def debug(self):
......
...@@ -353,11 +353,16 @@ class Test_TestSuite(unittest.TestCase, TestEquality): ...@@ -353,11 +353,16 @@ class Test_TestSuite(unittest.TestCase, TestEquality):
unittest.TestSuite.__call__(self, *args, **kw) unittest.TestSuite.__call__(self, *args, **kw)
suite = MySuite() suite = MySuite()
result = unittest.TestResult()
wrapper = unittest.TestSuite() wrapper = unittest.TestSuite()
wrapper.addTest(suite) wrapper.addTest(suite)
wrapper(unittest.TestResult()) wrapper(result)
self.assertTrue(suite.called) self.assertTrue(suite.called)
# reusing results should be permitted even if abominable
self.assertFalse(result._testRunEntered)
if __name__ == '__main__': if __name__ == '__main__':
unittest.main() unittest.main()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment