~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/__init__.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2011-08-12 16:12:23 UTC
  • mfrom: (6060.2.1 trunk)
  • Revision ID: pqm@pqm.ubuntu.com-20110812161223-hfvwsgbtb9vype5r
(vila) Merge 2.4 into trunk (Vincent Ladeuil)

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):