Rev 5473: (mbp) reset global verbosity after each command and test (Martin Pool) in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Fri Oct 8 08:13:17 BST 2010
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 5473 [merge]
revision-id: pqm at pqm.ubuntu.com-20101008071314-um52guvl7sel5r0h
parent: pqm at pqm.ubuntu.com-20101008050114-iwil1v5hc6o4b6xb
parent: mbp at sourcefrog.net-20101008062230-3bp1pczbqxzil1bi
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Fri 2010-10-08 08:13:14 +0100
message:
(mbp) reset global verbosity after each command and test (Martin Pool)
modified:
bzrlib/commands.py bzr.py-20050309040720-d10f4714595cf8c3
bzrlib/tests/__init__.py selftest.py-20050531073622-8d0e3c8845c97a64
bzrlib/tests/test_script.py test_script.py-20090901081156-y90z4w2t62fv7e7b-1
=== modified file 'bzrlib/commands.py'
--- a/bzrlib/commands.py 2010-08-13 07:56:06 +0000
+++ b/bzrlib/commands.py 2010-10-08 06:22:30 +0000
@@ -687,7 +687,12 @@
self._setup_outf()
- return self.run(**all_cmd_args)
+ try:
+ return self.run(**all_cmd_args)
+ finally:
+ # reset it, so that other commands run in the same process won't
+ # inherit state
+ trace.set_verbosity_level(0)
def _setup_run(self):
"""Wrap the defined run method on self with a cleanup.
=== modified file 'bzrlib/tests/__init__.py'
--- a/bzrlib/tests/__init__.py 2010-10-08 01:43:13 +0000
+++ b/bzrlib/tests/__init__.py 2010-10-08 07:13:14 +0000
@@ -858,6 +858,10 @@
self._track_transports()
self._track_locks()
self._clear_debug_flags()
+ # Isolate global verbosity level, to make sure it's reproducible
+ # between tests. We should get rid of this altogether: bug 656694. --
+ # mbp 20101008
+ self.overrideAttr(bzrlib.trace, '_verbosity_level', 0)
def debug(self):
# debug a frame up.
=== modified file 'bzrlib/tests/test_script.py'
--- a/bzrlib/tests/test_script.py 2010-09-13 09:00:03 +0000
+++ b/bzrlib/tests/test_script.py 2010-10-08 06:22:30 +0000
@@ -19,6 +19,7 @@
commands,
osutils,
tests,
+ trace,
ui,
)
from bzrlib.tests import script
@@ -245,6 +246,15 @@
cat dog "chicken" 'dragon'
""")
+ def test_verbosity_isolated(self):
+ """Global verbosity is isolated from commands run in scripts.
+ """
+ # see also 656694; we should get rid of global verbosity
+ self.run_script("""
+ $ bzr init --quiet a
+ """)
+ self.assertEquals(trace.is_quiet(), False)
+
class TestCat(script.TestCaseWithTransportAndScript):
More information about the bazaar-commits
mailing list