~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/__init__.py

  • Committer: Vincent Ladeuil
  • Date: 2011-08-12 09:49:24 UTC
  • mfrom: (6015.9.10 2.4)
  • mto: This revision was merged to the branch mainline in revision 6066.
  • Revision ID: v.ladeuil+lp@free.fr-20110812094924-knc5s0g7vs31a2f1
Merge 2.4 into trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
384
384
        getDetails = getattr(test, "getDetails", None)
385
385
        if getDetails is not None:
386
386
            getDetails().clear()
 
387
        # Clear _type_equality_funcs to try to stop TestCase instances
 
388
        # from wasting memory. 'clear' is not available in all Python
 
389
        # versions (bug 809048)
387
390
        type_equality_funcs = getattr(test, "_type_equality_funcs", None)
388
391
        if type_equality_funcs is not None:
389
 
            type_equality_funcs.clear()
 
392
            tef_clear = getattr(type_equality_funcs, "clear", None)
 
393
            if tef_clear is None:
 
394
                tef_instance_dict = getattr(type_equality_funcs, "__dict__", None)
 
395
                if tef_instance_dict is not None:
 
396
                    tef_clear = tef_instance_dict.clear
 
397
            if tef_clear is not None:
 
398
                tef_clear()
390
399
        self._traceback_from_test = None
391
400
 
392
401
    def startTests(self):