~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_errors.py

  • Committer: Robert Collins
  • Date: 2006-09-29 06:24:03 UTC
  • mto: This revision was merged to the branch mainline in revision 2587.
  • Revision ID: robertc@robertcollins.net-20060929062403-7e8b779181d8766c
``Transport.get`` has had its interface made more clear for ease of use.
Retrieval of a directory must now fail with either 'PathError' at open
time, or raise 'ReadError' on a read. (Robert Collins)

Show diffs side-by-side

added added

removed removed

Lines of Context:
53
53
                             repo.bzrdir.root_transport.base,
54
54
                             str(error))
55
55
 
 
56
    def test_read_error(self):
 
57
        # a unicode path to check that %r is being used.
 
58
        path = u'a path'
 
59
        error = errors.ReadError(path)
 
60
        self.assertEqualDiff("Error reading from u'a path'.", str(error))
 
61
 
 
62
    def test_transport_not_possible(self):
 
63
        error = errors.TransportNotPossible('readonly', 'original error')
 
64
        self.assertEqualDiff('Transport operation not possible:'
 
65
                         ' readonly original error', str(error))
 
66
 
56
67
 
57
68
class PassThroughError(errors.BzrNewError):
58
69
    """Pass through %(foo)s and %(bar)s"""
84
95
        e = ErrorWithBadFormat(not_thing='x')
85
96
        self.assertStartsWith(
86
97
            str(e), 'Unprintable exception ErrorWithBadFormat(')
87
 
 
88
 
 
89
 
class TestSpecificErrors(TestCase):
90
 
    
91
 
    def test_transport_not_possible(self):
92
 
        e = errors.TransportNotPossible('readonly', 'original error')
93
 
        self.assertEqual('Transport operation not possible:'
94
 
                         ' readonly original error', str(e))