~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-15 05:36:34 UTC
  • mto: This revision was merged to the branch mainline in revision 1797.
  • Revision ID: mbp@sourcefrog.net-20060615053634-4fd52ba691855659
Clean up many exception classes.

Errors indicating a user error are now shown with is_user_error on the
exception; use this rather than hardcoding a list of exceptions that should be
handled this way.

Exceptions now inherit from BzrNewException where possible to use consistent
formatting method.

Remove rather obsolete docstring test on Branch.missing_revisions.

Remove dead code from find_merge_base.


Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
 
27
27
from bzrlib.tests import TestCaseInTempDir, TestCase
28
28
from bzrlib.trace import mutter, report_exception
29
 
from bzrlib.errors import NotBranchError, BzrError, BzrNewError
 
29
from bzrlib.errors import NotBranchError
30
30
 
31
31
 
32
32
def _format_exception():
78
78
        self.assertTrue(len(msg) > 0)
79
79
        self.assertEqualDiff(msg, 'bzr: ERROR: Not a branch: wibble\n')
80
80
 
81
 
    def test_format_old_exception(self):
82
 
        # format a class that doesn't descend from BzrNewError; 
83
 
        # remove this test when everything is unified there
84
 
        self.assertFalse(issubclass(BzrError, BzrNewError))
85
 
        try:
86
 
            raise BzrError('some old error')
87
 
        except BzrError:
88
 
            pass
89
 
        msg = _format_exception()
90
 
        self.assertEqualDiff(msg, 'bzr: ERROR: some old error\n')
91
 
 
92
81
    def test_trace_unicode(self):
93
82
        """Write Unicode to trace log"""
94
83
        self.log(u'the unicode character for benzene is \N{BENZENE RING}')