[Python-Dev] unittest.TestSuite holding references to unittest.TestCase instances too long
matthewlmcclure at gmail.com
Fri Aug 2 13:51:23 CEST 2013
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.
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:
+ test = self._tests.pop(0)
+ except IndexError:
See also the conversation on django-developers that led me here.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-Dev