~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_transport.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:
25
25
                           TransportNotPossible,
26
26
                           ConnectionError,
27
27
                           DependencyNotPresent,
 
28
                           ReadError,
28
29
                           UnsupportedProtocol,
29
30
                           )
30
31
from bzrlib.tests import TestCase, TestCaseInTempDir
32
33
                              _get_protocol_handlers,
33
34
                              _get_transport_modules,
34
35
                              get_transport,
 
36
                              LateReadError,
35
37
                              register_lazy_transport,
36
38
                              _set_protocol_handlers,
37
39
                              Transport,
100
102
        finally:
101
103
            _set_protocol_handlers(saved_handlers)
102
104
 
 
105
    def test_LateReadError(self):
 
106
        """The LateReadError helper should raise on read()."""
 
107
        a_file = LateReadError('a path')
 
108
        try:
 
109
            a_file.read()
 
110
        except ReadError, error:
 
111
            self.assertEqual('a path', error.path)
 
112
        self.assertRaises(ReadError, a_file.read, 40)
 
113
        a_file.close()
 
114
 
103
115
 
104
116
class TestCoalesceOffsets(TestCase):
105
117