Sent from my iPhone
On 2 Aug 2013, at 14:51, Matt McClure
It seems unittest.TestSuite holds references to unittest.TestCase instances after the test runs, until the test suite finishes. In a large suite, where the TestCase instances consume memory during execution, that can lead to exhausting all available memory and the OS killing the test process.
Well individual tests not releasing resources could be seen as a bug in those tests. That aside, there's an open bug for this with some discussion and a proposed fix: http://bugs.python.org/issue11798 The agreed on approach just needs doing. Michael
What do you think of a change like this?
$ hg diff diff -r 3bd55ec317a7 Lib/unittest/suite.py --- a/Lib/unittest/suite.py Thu Aug 01 23:57:21 2013 +0200 +++ b/Lib/unittest/suite.py Fri Aug 02 07:42:22 2013 -0400 @@ -90,7 +90,12 @@ if getattr(result, '_testRunEntered', False) is False: result._testRunEntered = topLevel = True
- for test in self: + while True: + try: + test = self._tests.pop(0) + except IndexError: + break + if result.shouldStop: break
See also the conversation on django-developers[1] that led me here.
[1]: https://groups.google.com/forum/#!topic/django-developers/XUMetDSGVT0
-- Matt McClure http://matthewlmcclure.com http://www.mapmyfitness.com/profile/matthewlmcclure _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/fuzzyman%40voidspace.org.u...