On Fri, Jul 26, 2013 at 11:03 AM, Matt McClure
<matthewlmccl...@gmail.com> wrote:
> TestSuite holds references to each TestCase instance. So attributes of my
> TestCase subclasses don't get freed by the garbage collector until the last
> reference to TestSuite disappears, which isn't until the entire test run
> ends. In a large test suite, the test run exhausts memory and the OS kills
> it before the suite finishes.
>
> The most obvious solution to me is to put tearDown methods in all my
> TestCase subclasses that delete the references to their own attributes. But
> it seems like there has to be a more general, automatic solution. I can
> start to answer my own question. But I'm interested to know if others run
> into similar problems and how you solve them.
>
> It looks like there are at least two participants that hold TestCase
> references longer than desirable.
>
> 1.  TestSuite. Here's a minimal hack to release the reference that TestSuite
> would otherwise hold after a TestCase runs until the remainder of the suite
> had finished.
>
> diff --git a/django/utils/unittest/suite.py b/django/utils/unittest/suite.py

django.utils.unittest is a copy of the Python>= 2.7 stdlib unittest library
(aka unittest2)

Looking at the list of classes involved in your description seems to indicate
you might want to report your findings to the upstream maintainers.

That way if it's actually confirmed as an issue, the solution will benefit
much more people than people doing testing in Django.

Regards,

-- 
Ramiro Morales
@ramiromorales

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to