/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_crash.py

  • Committer: Vincent Ladeuil
  • Date: 2011-07-06 09:22:00 UTC
  • mfrom: (6008 +trunk)
  • mto: (6012.1.1 trunk)
  • mto: This revision was merged to the branch mainline in revision 6013.
  • Revision ID: v.ladeuil+lp@free.fr-20110706092200-7iai2mwzc0sqdsvf
MergingĀ inĀ trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
from StringIO import StringIO
21
21
import sys
22
22
 
23
 
from testtools.matchers import DocTestMatches
24
 
 
25
23
from bzrlib import (
26
24
    config,
27
25
    crash,
43
41
        self.overrideEnv('APPORT_CRASH_DIR', crash_dir)
44
42
        self.assertEquals(crash_dir, config.crash_dir())
45
43
 
 
44
        self.overrideAttr(
 
45
            plugin,
 
46
            'plugin_warnings',
 
47
            {'example': ['Failed to load plugin foo']})
 
48
 
46
49
        stderr = StringIO()
47
50
 
48
51
        try:
72
75
        self.assertContainsRe(report, 'test_apport_report')
73
76
        # should also be in there
74
77
        self.assertContainsRe(report, '(?m)^CommandLine:')
 
78
        self.assertContainsRe(
 
79
            report,
 
80
            'Failed to load plugin foo')
75
81
 
76
82
 
77
83
class TestNonApportReporting(tests.TestCase):
95
101
        except AssertionError, e:
96
102
            pass
97
103
        crash.report_bug_legacy(sys.exc_info(), err_file)
98
 
        self.assertThat(
99
 
            err_file.getvalue(),
100
 
            DocTestMatches("""\
101
 
bzr: ERROR: exceptions.AssertionError: my error
102
 
 
103
 
Traceback (most recent call last):
104
 
  ...
105
 
AssertionError: my error
106
 
 
107
 
bzr ... on python ...
108
 
arguments: ...
109
 
plugins: fake_plugin[1.2.3]
110
 
encoding: ...
111
 
 
112
 
*** Bazaar has encountered an internal error.  This probably indicates a
113
 
    bug in Bazaar.  You can help us fix it by filing a bug report at
114
 
        https://bugs.launchpad.net/bzr/+filebug
115
 
    including this traceback and a description of the problem.
116
 
""", flags=doctest.ELLIPSIS|doctest.REPORT_UDIFF))
 
104
        report = err_file.getvalue()
 
105
        for needle in [
 
106
            "bzr: ERROR: exceptions.AssertionError: my error",
 
107
            r"Traceback \(most recent call last\):",
 
108
            r"plugins: fake_plugin\[1\.2\.3\]",
 
109
            ]:
 
110
            self.assertContainsRe(
 
111
                    report,
 
112
                    needle)