Rev 4799: Free tests after executing them as an alternative way to clean up memory usage. in http://bazaar.launchpad.net/~lifeless/bzr/subunit
Robert Collins
robertc at robertcollins.net
Sat Dec 5 09:04:24 GMT 2009
At http://bazaar.launchpad.net/~lifeless/bzr/subunit
------------------------------------------------------------
revno: 4799
revision-id: robertc at robertcollins.net-20091205090419-emezfnmspowra66n
parent: robertc at robertcollins.net-20091205084450-1z180vgkxb2cfjy6
committer: Robert Collins <robertc at robertcollins.net>
branch nick: subunit
timestamp: Sat 2009-12-05 20:04:19 +1100
message:
Free tests after executing them as an alternative way to clean up memory usage.
=== modified file 'bzrlib/tests/TestUtil.py'
--- a/bzrlib/tests/TestUtil.py 2009-03-23 14:59:43 +0000
+++ b/bzrlib/tests/TestUtil.py 2009-12-05 09:04:19 +0000
@@ -72,6 +72,18 @@
visitor.visitSuite(self)
visitTests(self, visitor)
+ def run(self, result):
+ """Run the tests in the suite, discarding references after running."""
+ tests = list(self)
+ tests.reverse()
+ self._tests = []
+ while tests:
+ if result.shouldStop:
+ self._tests = reversed(tests)
+ break
+ tests.pop().run(result)
+ return result
+
class TestLoader(unittest.TestLoader):
"""Custom TestLoader to extend the stock python one."""
More information about the bazaar-commits
mailing list