Rev 5070: (vila, for doxxx) Fix trace.show_error signature in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Tue Mar 2 14:46:20 GMT 2010
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 5070 [merge]
revision-id: pqm at pqm.ubuntu.com-20100302144617-2vtu14t81e3acd8f
parent: pqm at pqm.ubuntu.com-20100302105359-p9p4afvov2gsn1zx
parent: gordon at doxxx.net-20100225131508-2ntxutul7ibo92wa
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Tue 2010-03-02 14:46:17 +0000
message:
(vila, for doxxx) Fix trace.show_error signature
modified:
bzrlib/tests/test_trace.py testtrace.py-20051110225523-a21117fc7a07eeff
bzrlib/trace.py trace.py-20050309040759-c8ed824bdcd4748a
=== modified file 'bzrlib/tests/test_trace.py'
--- a/bzrlib/tests/test_trace.py 2010-02-23 07:43:11 +0000
+++ b/bzrlib/tests/test_trace.py 2010-02-25 13:15:08 +0000
@@ -36,6 +36,7 @@
pop_log_file,
push_log_file,
_rollover_trace_maybe,
+ show_error,
)
@@ -215,6 +216,26 @@
# have to do a replaceent here as well.
self.assertContainsRe(log, "ascii argument: \xb5".decode('utf8',
'replace'))
+
+ def test_show_error(self):
+ show_error('error1')
+ show_error(u'error2 \xb5 blah')
+ show_error('arg: %s', 'blah')
+ show_error('arg2: %(key)s', {'key':'stuff'})
+ try:
+ raise Exception("oops")
+ except:
+ show_error('kwarg', exc_info=True)
+ log = self.get_log()
+ self.assertContainsRe(log, 'error1')
+ self.assertContainsRe(log, u'error2 \xb5 blah')
+ self.assertContainsRe(log, 'arg: blah')
+ self.assertContainsRe(log, 'arg2: stuff')
+ self.assertContainsRe(log, 'kwarg')
+ self.assertContainsRe(log, 'Traceback \\(most recent call last\\):')
+ self.assertContainsRe(log, 'File ".*test_trace.py", line .*, in test_show_error')
+ self.assertContainsRe(log, 'raise Exception\\("oops"\\)')
+ self.assertContainsRe(log, 'Exception: oops')
def test_push_log_file(self):
"""Can push and pop log file, and this catches mutter messages.
=== modified file 'bzrlib/trace.py'
--- a/bzrlib/trace.py 2010-02-23 07:43:11 +0000
+++ b/bzrlib/trace.py 2010-02-24 01:20:51 +0000
@@ -145,7 +145,7 @@
_bzr_logger.error(*args, **kwargs)
-def show_error(msg):
+def show_error(*args, **kwargs):
"""Show an error message to the user.
Don't use this for exceptions, use report_exception instead.
More information about the bazaar-commits
mailing list