summaryrefslogtreecommitdiffstats
path: root/Lib/unittest
diff options
context:
space:
mode:
authorMichael Foord <fuzzyman@voidspace.org.uk>2010-12-19 04:07:28 (GMT)
committerMichael Foord <fuzzyman@voidspace.org.uk>2010-12-19 04:07:28 (GMT)
commitcca5be2e4c5b1a45f42e63e9b1a0a6c6a6647876 (patch)
tree6c211a07c8a1bc4eb34a22f011e539b71724087a /Lib/unittest
parentf100dbd6009e18bb1ab14fa6da8732751b1a9add (diff)
downloadcpython-cca5be2e4c5b1a45f42e63e9b1a0a6c6a6647876.zip
cpython-cca5be2e4c5b1a45f42e63e9b1a0a6c6a6647876.tar.gz
cpython-cca5be2e4c5b1a45f42e63e9b1a0a6c6a6647876.tar.bz2
Improvement to fix for issue 9926 to allow TestResult to be reused.
Diffstat (limited to 'Lib/unittest')
-rw-r--r--Lib/unittest/suite.py1
-rw-r--r--Lib/unittest/test/test_suite.py7
2 files changed, 7 insertions, 1 deletions
diff --git a/Lib/unittest/suite.py b/Lib/unittest/suite.py
index 73f0e17..77ce089 100644
--- a/Lib/unittest/suite.py
+++ b/Lib/unittest/suite.py
@@ -104,6 +104,7 @@ class TestSuite(BaseTestSuite):
if topLevel:
self._tearDownPreviousClass(None, result)
self._handleModuleTearDown(result)
+ result._testRunEntered = False
return result
def debug(self):
diff --git a/Lib/unittest/test/test_suite.py b/Lib/unittest/test/test_suite.py
index fa32247..2db978d 100644
--- a/Lib/unittest/test/test_suite.py
+++ b/Lib/unittest/test/test_suite.py
@@ -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()