/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_transport_implementations.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2006-09-16 02:23:41 UTC
  • mfrom: (2001.3.4 short_reads)
  • Revision ID: pqm@pqm.ubuntu.com-20060916022341-3d816fe2ecff52c1
(jam) raise ShortReadvError when we don't get back enough data

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
import sys
27
27
 
28
28
from bzrlib import (
 
29
    errors,
29
30
    osutils,
30
31
    urlutils,
31
32
    )
1303
1304
        except NoSmartServer:
1304
1305
            # as long as we got it we're fine
1305
1306
            pass
 
1307
 
 
1308
    def test_readv_short_read(self):
 
1309
        transport = self.get_transport()
 
1310
        if transport.is_readonly():
 
1311
            file('a', 'w').write('0123456789')
 
1312
        else:
 
1313
            transport.put_bytes('a', '01234567890')
 
1314
 
 
1315
        # This is intentionally reading off the end of the file
 
1316
        # since we are sure that it cannot get there
 
1317
        self.assertListRaises((errors.ShortReadvError, AssertionError),
 
1318
                              transport.readv, 'a', [(1,1), (8,10)])
 
1319
 
 
1320
        # This is trying to seek past the end of the file, it should
 
1321
        # also raise a special error
 
1322
        self.assertListRaises(errors.ShortReadvError,
 
1323
                              transport.readv, 'a', [(12,2)])