~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_trace.py

Merge from mbp.

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
 
25
25
from bzrlib.tests import TestCaseInTempDir, TestCase
26
26
from bzrlib.trace import format_exception_short, mutter
27
 
from bzrlib.errors import NotBranchError
 
27
from bzrlib.errors import NotBranchError, BzrError, BzrNewError
28
28
 
29
29
class TestTrace(TestCase):
30
30
    def test_format_sys_exception(self):
50
50
        msg = format_exception_short(sys.exc_info())
51
51
        self.assertEqualDiff(msg, 'Not a branch: wibble')
52
52
 
 
53
    def test_format_old_exception(self):
 
54
        # format a class that doesn't descend from BzrNewError; 
 
55
        # remove this test when everything is unified there
 
56
        self.assertFalse(issubclass(BzrError, BzrNewError))
 
57
        try:
 
58
            raise BzrError('some old error')
 
59
        except BzrError:
 
60
            pass
 
61
        msg = format_exception_short(sys.exc_info())
 
62
        self.assertEqualDiff(msg, 'some old error')
 
63
 
53
64
    def test_trace_unicode(self):
54
65
        """Write Unicode to trace log"""
55
66
        self.log(u'the unicode character for benzene is \N{BENZENE RING}')