1
# Copyright (C) 2009 Canonical Ltd
3
# This program is free software; you can redistribute it and/or modify
4
# it under the terms of the GNU General Public License as published by
5
# the Free Software Foundation; either version 2 of the License, or
6
# (at your option) any later version.
8
# This program is distributed in the hope that it will be useful,
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
# GNU General Public License for more details.
13
# You should have received a copy of the GNU General Public License
14
# along with this program; if not, write to the Free Software
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
from StringIO import StringIO
26
from bzrlib.tests import features
29
class TestApportReporting(tests.TestCase):
31
_test_needs_features = [features.ApportFeature]
33
def test_apport_report_contents(self):
35
raise AssertionError("my error")
36
except AssertionError, e:
39
crash._write_apport_report_to_file(sys.exc_info(), outf)
40
report = outf.getvalue()
42
self.assertContainsRe(report, '(?m)^BzrVersion:')
43
# should be in the traceback
44
self.assertContainsRe(report, 'my error')
45
self.assertContainsRe(report, 'AssertionError')
46
self.assertContainsRe(report, 'test_apport_report_contents')
47
# should also be in there
48
self.assertContainsRe(report, '(?m)^CommandLine:')