~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/per_transport.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2011-05-18 19:22:46 UTC
  • mfrom: (5861.2.7 bzr-pypy)
  • Revision ID: pqm@pqm.ubuntu.com-20110518192246-x1duixv8rt9v2xml
(mbp) be more careful about closing files in selftest,
 so that more of it passes on pypy (Wouter van Heyst)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1626
1626
    def test_readv(self):
1627
1627
        transport = self.get_transport()
1628
1628
        if transport.is_readonly():
1629
 
            file('a', 'w').write('0123456789')
 
1629
            with file('a', 'w') as f: f.write('0123456789')
1630
1630
        else:
1631
1631
            transport.put_bytes('a', '0123456789')
1632
1632
 
1642
1642
    def test_readv_out_of_order(self):
1643
1643
        transport = self.get_transport()
1644
1644
        if transport.is_readonly():
1645
 
            file('a', 'w').write('0123456789')
 
1645
            with file('a', 'w') as f: f.write('0123456789')
1646
1646
        else:
1647
1647
            transport.put_bytes('a', '01234567890')
1648
1648
 
1720
1720
        transport = self.get_transport()
1721
1721
        # test from observed failure case.
1722
1722
        if transport.is_readonly():
1723
 
            file('a', 'w').write('a'*1024*1024)
 
1723
            with file('a', 'w') as f: f.write('a'*1024*1024)
1724
1724
        else:
1725
1725
            transport.put_bytes('a', 'a'*1024*1024)
1726
1726
        broken_vector = [(465219, 800), (225221, 800), (445548, 800),
1760
1760
    def test_readv_short_read(self):
1761
1761
        transport = self.get_transport()
1762
1762
        if transport.is_readonly():
1763
 
            file('a', 'w').write('0123456789')
 
1763
            with file('a', 'w') as f: f.write('0123456789')
1764
1764
        else:
1765
1765
            transport.put_bytes('a', '01234567890')
1766
1766