~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_trace.py

  • Committer: Martin Pool
  • Date: 2006-06-04 22:04:20 UTC
  • mto: This revision was merged to the branch mainline in revision 1797.
  • Revision ID: mbp@sourcefrog.net-20060604220420-6bab3e2b6ebe013e
Cleanup more exception-formatting code

Show diffs side-by-side

added added

removed removed

Lines of Context:
45
45
            pass
46
46
        err = _format_exception()
47
47
        self.assertEqualDiff(err.splitlines()[0],
48
 
                'bzr: unhandled error: exceptions.NotImplementedError: time travel')
 
48
                'bzr: ERROR: exceptions.NotImplementedError: time travel')
49
49
        self.assertContainsRe(err,
50
50
                r'File.*test_trace.py')
51
51
 
 
52
    def test_format_interrupt_exception(self):
 
53
        try:
 
54
            raise KeyboardInterrupt()
 
55
        except KeyboardInterrupt():
 
56
            # XXX: Some risk that a *real* keyboard interrupt won't be seen
 
57
            pass
 
58
        msg = _format_exception()
 
59
        self.assertTrue(len(msg) > 0)
 
60
        self.assertEqualDiff(msg, 'bzr: interrupted\n')
 
61
 
52
62
    def test_format_exception(self):
53
63
        """Short formatting of bzr exceptions"""
54
64
        try: