disable_test_log(enable_test_log(to_file)) should be a noop, but isn't

Bug #124849 reported by Jonathan Lange
2
Affects Status Importance Assigned to Milestone
Bazaar
Fix Released
Medium
Martin Pool

Bug Description

   opaque_handle = enable_test_log(to_file)
   disable_test_log(opaque_handle)

isn't the no-op it should be, since it ends up effectively calling enable_default_logging() instead of leaving the logging system uninitialised.

enable/disable_test_log should *just* restore the state of the trace module, and not call disable/enable_default_logging.

Related branches

Revision history for this message
Jonathan Lange (jml) wrote :

This bug was discovered while investigating bug 124153.

Revision history for this message
John A Meinel (jameinel) wrote :

Basically, enable_test_log() sets log to a specific file (for the test suite), but disable_test_log pretty much universally calls 'enable_default_logging'. Which is okay for bzr itself, but other people calling our test suite will not use the same logging functionality.

(Most notably Launchpad :)

So there should be a better way such that enable/disable restores the original state. (Possibly by just updating the returned tuple to make it easier to restore the old settings)

Changed in bzr:
importance: Undecided → Medium
status: New → Confirmed
Revision history for this message
Martin Pool (mbp) wrote :

working on this with jml

Changed in bzr:
assignee: nobody → mbp
Revision history for this message
Martin Pool (mbp) wrote :

Fixed in my branch, I think:

[1] mbp@lithe% python ../124153-repro.py
failed to open trace file: [Errno 2] No such file or directory: '/tmp/testbzr-BH_NjX.tmp/tmpzjj-Jt/home/.bzr.log'
[1] mbp@lithe% pythonpath=. python ../124153-repro.py

Martin Pool (mbp)
Changed in bzr:
status: Confirmed → Fix Committed
Vincent Ladeuil (vila)
Changed in bzr:
milestone: none → 1.2
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.