Merge lp:~gz/bzr/trivial_discard_log_memento_607413 into lp:bzr
Status: | Merged |
---|---|
Approved by: | Jelmer Vernooij |
Approved revision: | no longer in the source branch. |
Merged at revision: | 6222 |
Proposed branch: | lp:~gz/bzr/trivial_discard_log_memento_607413 |
Merge into: | lp:bzr |
Diff against target: |
33 lines (+4/-8) 1 file modified
bzrlib/tests/__init__.py (+4/-8) |
To merge this branch: | bzr merge lp:~gz/bzr/trivial_discard_log_memento_607413 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Jelmer Vernooij (community) | Approve | ||
Review via email: mp+79572@code.launchpad.net |
Commit message
Delete _log_memento after TestCase is done with it so as not to upset the funky weakref cleanup mechanism.
Description of the change
Delete _log_memento after TestCase is done with it so as not to upset the funky weakref cleanup mechanism. The original visible fallout got fixed upstream in the logging module, and with bug 613247 landed the general case of accidentally persisting resources is handled. This branch just makes sure that even with TestCase objects we keep alive on purpose (errors, for instance), the token is thrown away so logging doesn't keep tracking it.
While I was there I updated the docstrings for the TestCase log setup and teardown functions as they no longer deal in tempfiles.
Are we sure this is safe across supported versions? You mention fixed
upstream, but that always concerns me about compatibility.
John
=:->
On Oct 17, 2011 5:38 PM, "Martin Packman" <email address hidden>
wrote:
> Martin Packman has proposed merging /bugs.launchpad .net/bzr/ +bug/607413 /code.launchpad .net/~gz/ bzr/trivial_ discard_ log_memento_ 607413/ +merge/ 79572 /code.launchpad .net/~gz/ bzr/trivial_ discard_ log_memento_ 607413/ +merge/ 79572 tests/_ _init__ .py' tests/_ _init__ .py 2011-10-14 01:48:16 +0000 tests/_ _init__ .py 2011-10-17 15:36:26 +0000 self): contents_ for_weird_ testtools_ api(): log_file. getvalue( ).decode( (self._ finishLogFile) self): trace_file. flush() log_file( self._log_ memento) LockCheck( self):
> lp:~gz/bzr/trivial_discard_log_memento_607413 into lp:bzr.
>
> Requested reviews:
> bzr-core (bzr-core)
> Related bugs:
> Bug #607413 in Bazaar: " Exception atexit with selftest and Python 2.7"
> https:/
>
> For more details, see:
>
> https:/
>
> Delete _log_memento after TestCase is done with it so as not to upset the
> funky weakref cleanup mechanism. The original visible fallout got fixed
> upstream in the logging module, and with bug 613247 landed the general case
> of accidentally persisting resources is handled. This branch just makes sure
> that even with TestCase objects we keep alive on purpose (errors, for
> instance), the token is thrown away so logging doesn't keep tracking it.
>
> While I was there I updated the docstrings for the TestCase log setup and
> teardown functions as they no longer deal in tempfiles.
> --
>
> https:/
> Your team bzr-core is requested to review the proposed merge of
> lp:~gz/bzr/trivial_discard_log_memento_607413 into lp:bzr.
>
> === modified file 'bzrlib/
> --- bzrlib/
> +++ bzrlib/
> @@ -1718,10 +1718,7 @@
> return result
>
> def _startLogFile(
> - """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_
> return [pseudo_
> @@ -1734,14 +1731,13 @@
> self.addCleanup
>
> def _finishLogFile(
> - """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
> trace._
> trace.pop_
> + # The logging module now tracks references for cleanup so discard
> ours
> + del self._log_memento
>
> def thisFailsStrict
> """It is known that this test would fail with -Dstrict_locks.
>
>
>