[Python-Dev] Test cases not garbage collected after run

Michael Foord fuzzyman at voidspace.org.uk
Thu Apr 14 13:34:55 CEST 2011


On 14/04/2011 00:23, Martin (gzlist) wrote:
> On 07/04/2011, Michael Foord<fuzzyman at voidspace.org.uk>  wrote:
>> On 07/04/2011 20:18, Robert Collins wrote:
>>> Testtools did something to address this problem, but I forget what it
>>> was offhand.
> Some issues were worked around, but I don't remember any comprehensive solution.
>
>> The proposed "fix" is to make test suite runs destructive, either
>> replacing TestCase instances with None or pop'ing tests after they are
>> run (the latter being what twisted Trial does). run-in-a-loop helpers
>> could still repeatedly iterate over suites, just not call the suite.
> Just pop-ing is unlikely to be sufficient in practice. The Bazaar test
> suite (which uses testtools nowadays) has code that pops during the
> run, but still keeps every case alive for the duration. That trebles
> the runtime on my memory-constrained box unless I add a hack that
> clears the __dict__ of every testcase after it's run.
I'd be interested to know what is keeping the tests alive even when the 
test suite isn't. As far as I know there is nothing else in unittest 
that would do that.

It's either a general problem that unittest can fix, or it is a problem 
*caused* by the bazaar test suite and should be fixed there. Bazaar does 
some funky stuff copying tests to run them with different backends, so 
it is possible that this is the cause of the problem (and it isn't a 
general problem).

All the best,

Michael Foord
> Martin


-- 
http://www.voidspace.org.uk/

May you do good and not evil
May you find forgiveness for yourself and forgive others
May you share freely, never taking more than you give.
-- the sqlite blessing http://www.sqlite.org/different.html



More information about the Python-Dev mailing list