~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/per_transport.py

  • Committer: INADA Naoki
  • Date: 2011-05-05 09:15:34 UTC
  • mto: (5830.3.3 i18n-msgfmt)
  • mto: This revision was merged to the branch mainline in revision 5873.
  • Revision ID: songofacandy@gmail.com-20110505091534-7sv835xpofwrmpt4
Add update-pot command to Makefile and tools/bzrgettext script that
extracts help text from bzr commands.

Show diffs side-by-side

added added

removed removed

Lines of Context:
207
207
                    ]
208
208
        self.build_tree(files, transport=t, line_endings='binary')
209
209
        self.assertRaises(NoSuchFile, t.get, 'c')
210
 
        def iterate_and_close(func, *args):
211
 
            for f in func(*args):
212
 
                # We call f.read() here because things like paramiko actually
213
 
                # spawn a thread to prefetch the content, which we want to
214
 
                # consume before we close the handle.
215
 
                content = f.read()
216
 
                f.close()
217
 
        self.assertRaises(NoSuchFile, iterate_and_close,
218
 
                          t.get_multi, ['a', 'b', 'c'])
219
 
        self.assertRaises(NoSuchFile, iterate_and_close,
220
 
                          t.get_multi, iter(['a', 'b', 'c']))
 
210
        self.assertListRaises(NoSuchFile, t.get_multi, ['a', 'b', 'c'])
 
211
        self.assertListRaises(NoSuchFile, t.get_multi, iter(['a', 'b', 'c']))
221
212
 
222
213
    def test_get_directory_read_gives_ReadError(self):
223
214
        """consistent errors for read() on a file returned by get()."""
1088
1079
        self.assertListRaises(NoSuchFile, t.stat_multi, iter(['a', 'c', 'd']))
1089
1080
        self.build_tree(['subdir/', 'subdir/file'], transport=t)
1090
1081
        subdir = t.clone('subdir')
1091
 
        st = subdir.stat('./file')
1092
 
        st = subdir.stat('.')
 
1082
        subdir.stat('./file')
 
1083
        subdir.stat('.')
1093
1084
 
1094
1085
    def test_hardlink(self):
1095
1086
        from stat import ST_NLINK
1626
1617
    def test_readv(self):
1627
1618
        transport = self.get_transport()
1628
1619
        if transport.is_readonly():
1629
 
            with file('a', 'w') as f: f.write('0123456789')
 
1620
            file('a', 'w').write('0123456789')
1630
1621
        else:
1631
1622
            transport.put_bytes('a', '0123456789')
1632
1623
 
1642
1633
    def test_readv_out_of_order(self):
1643
1634
        transport = self.get_transport()
1644
1635
        if transport.is_readonly():
1645
 
            with file('a', 'w') as f: f.write('0123456789')
 
1636
            file('a', 'w').write('0123456789')
1646
1637
        else:
1647
1638
            transport.put_bytes('a', '01234567890')
1648
1639
 
1720
1711
        transport = self.get_transport()
1721
1712
        # test from observed failure case.
1722
1713
        if transport.is_readonly():
1723
 
            with file('a', 'w') as f: f.write('a'*1024*1024)
 
1714
            file('a', 'w').write('a'*1024*1024)
1724
1715
        else:
1725
1716
            transport.put_bytes('a', 'a'*1024*1024)
1726
1717
        broken_vector = [(465219, 800), (225221, 800), (445548, 800),
1760
1751
    def test_readv_short_read(self):
1761
1752
        transport = self.get_transport()
1762
1753
        if transport.is_readonly():
1763
 
            with file('a', 'w') as f: f.write('0123456789')
 
1754
            file('a', 'w').write('0123456789')
1764
1755
        else:
1765
1756
            transport.put_bytes('a', '01234567890')
1766
1757