/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/per_transport.py

  • Committer: Jelmer Vernooij
  • Date: 2011-01-19 18:40:15 UTC
  • mfrom: (5622 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5624.
  • Revision ID: jelmer@samba.org-20110119184015-ahycpz0yduideif0
merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005-2010 Canonical Ltd
 
1
# Copyright (C) 2005-2011 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
98
98
 
99
99
    def setUp(self):
100
100
        super(TransportTests, self).setUp()
101
 
        self._captureVar('BZR_NO_SMART_VFS', None)
 
101
        self.overrideEnv('BZR_NO_SMART_VFS', None)
102
102
 
103
103
    def check_transport_contents(self, content, transport, relpath):
104
 
        """Check that transport.get(relpath).read() == content."""
105
 
        self.assertEqualDiff(content, transport.get(relpath).read())
 
104
        """Check that transport.get_bytes(relpath) == content."""
 
105
        self.assertEqualDiff(content, transport.get_bytes(relpath))
106
106
 
107
107
    def test_ensure_base_missing(self):
108
108
        """.ensure_base() should create the directory if it doesn't exist"""
256
256
        handle = t.open_write_stream('foo')
257
257
        try:
258
258
            handle.write('b')
259
 
            self.assertEqual('b', t.get('foo').read())
 
259
            self.assertEqual('b', t.get_bytes('foo'))
260
260
        finally:
261
261
            handle.close()
262
262
 
268
268
        try:
269
269
            handle.write('b')
270
270
            self.assertEqual('b', t.get_bytes('foo'))
271
 
            self.assertEqual('b', t.get('foo').read())
 
271
            f = t.get('foo')
 
272
            try:
 
273
                self.assertEqual('b', f.read())
 
274
            finally:
 
275
                f.close()
272
276
        finally:
273
277
            handle.close()
274
278
 
640
644
            self.build_tree(files, transport=transport_from)
641
645
            self.assertEqual(4, transport_from.copy_to(files, transport_to))
642
646
            for f in files:
643
 
                self.check_transport_contents(transport_to.get(f).read(),
 
647
                self.check_transport_contents(transport_to.get_bytes(f),
644
648
                                              transport_from, f)
645
649
 
646
650
        t = self.get_transport()
669
673
        files = ['a', 'b', 'c', 'd']
670
674
        t.copy_to(iter(files), temp_transport)
671
675
        for f in files:
672
 
            self.check_transport_contents(temp_transport.get(f).read(),
 
676
            self.check_transport_contents(temp_transport.get_bytes(f),
673
677
                                          t, f)
674
678
        del temp_transport
675
679