Rev 5798: (mbp) Rewrite test_report_bug_legacy away from using doctest (see bug in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Mon Apr 18 04:55:05 UTC 2011


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 5798 [merge]
revision-id: pqm at pqm.ubuntu.com-20110418045500-ce6lkgyiq7f47q43
parent: pqm at pqm.ubuntu.com-20110418031503-x95t7v5ujr0lh9yw
parent: mbp at sourcefrog.net-20110418034505-2yqoat6blcygx3px
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Mon 2011-04-18 04:55:00 +0000
message:
  (mbp) Rewrite test_report_bug_legacy away from using doctest (see bug
   764188) (Martin Pool)
modified:
  bzrlib/tests/test_crash.py     test_crash.py-20090820042958-jglgza3wrn03ha9e-2
=== modified file 'bzrlib/tests/test_crash.py'
--- a/bzrlib/tests/test_crash.py	2011-04-05 12:11:26 +0000
+++ b/bzrlib/tests/test_crash.py	2011-04-18 03:45:05 +0000
@@ -20,8 +20,6 @@
 from StringIO import StringIO
 import sys
 
-from testtools.matchers import DocTestMatches
-
 from bzrlib import (
     config,
     crash,
@@ -103,22 +101,12 @@
         except AssertionError, e:
             pass
         crash.report_bug_legacy(sys.exc_info(), err_file)
-        self.assertThat(
-            err_file.getvalue(),
-            DocTestMatches("""\
-bzr: ERROR: exceptions.AssertionError: my error
-
-Traceback (most recent call last):
-  ...
-AssertionError: my error
-
-bzr ... on python ...
-arguments: ...
-plugins: fake_plugin[1.2.3]
-encoding: ...
-
-*** Bazaar has encountered an internal error.  This probably indicates a
-    bug in Bazaar.  You can help us fix it by filing a bug report at
-        https://bugs.launchpad.net/bzr/+filebug
-    including this traceback and a description of the problem.
-""", flags=doctest.ELLIPSIS|doctest.REPORT_UDIFF))
+        report = err_file.getvalue()
+        for needle in [
+            "bzr: ERROR: exceptions.AssertionError: my error",
+            r"Traceback \(most recent call last\):",
+            r"plugins: fake_plugin\[1\.2\.3\]",
+            ]:
+            self.assertContainsRe(
+                    report,
+                    needle)




More information about the bazaar-commits mailing list