Rev 6222: (mbp) Delete _log_memento after TestCase is done with it so as not to upset in file:///srv/

Patch Queue Manager pqm at
Tue Oct 18 08:00:21 UTC 2011

At file:///srv/

revno: 6222 [merge]
revision-id: pqm at
parent: pqm at
parent: martin.packman at
committer: Patch Queue Manager <pqm at>
branch nick: +trunk
timestamp: Tue 2011-10-18 08:00:20 +0000
  (mbp) Delete _log_memento after TestCase is done with it so as not to upset
   the funky weakref cleanup mechanism. (Martin Packman)
=== modified file 'bzrlib/tests/'
--- a/bzrlib/tests/	2011-10-14 01:48:16 +0000
+++ b/bzrlib/tests/	2011-10-17 15:27:38 +0000
@@ -1718,10 +1718,7 @@
         return result
     def _startLogFile(self):
-        """Send bzr and test log messages to a temporary file.
-        The file is removed as the test is torn down.
-        """
+        """Setup a in-memory target for bzr and testcase log messages"""
         pseudo_log_file = StringIO()
         def _get_log_contents_for_weird_testtools_api():
             return [pseudo_log_file.getvalue().decode(
@@ -1734,14 +1731,13 @@
     def _finishLogFile(self):
-        """Finished with the log file.
-        Close the file and delete it.
-        """
+        """Flush and dereference the in-memory log for this testcase"""
         if trace._trace_file:
             # flush the log file, to get all content
+        # The logging module now tracks references for cleanup so discard ours
+        del self._log_memento
     def thisFailsStrictLockCheck(self):
         """It is known that this test would fail with -Dstrict_locks.

More information about the bazaar-commits mailing list