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

Martin (gzlist) gzlist at googlemail.com
Thu Apr 14 01:23:57 CEST 2011


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.

Martin


More information about the Python-Dev mailing list