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

  • Committer: Martin
  • Date: 2017-05-21 18:16:32 UTC
  • mto: (6621.2.22 py3)
  • mto: This revision was merged to the branch mainline in revision 6624.
  • Revision ID: gzlist@googlemail.com-20170521181632-kll0wqnsq8pipfpj
Use BytesIO or StringIO from bzrlib.sixish

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
17
 
18
 
from cStringIO import StringIO
19
18
import errno
20
19
import os
21
20
import subprocess
30
29
    urlutils,
31
30
    )
32
31
from bzrlib.directory_service import directories
 
32
from bzrlib.sixish import (
 
33
    BytesIO,
 
34
    )
33
35
from bzrlib.transport import (
34
36
    chroot,
35
37
    fakenfs,
272
274
        t = memory.MemoryTransport()
273
275
        t.append_bytes('path', 'content')
274
276
        self.assertEqual(t.get('path').read(), 'content')
275
 
        t.append_file('path', StringIO('content'))
 
277
        t.append_file('path', BytesIO(b'content'))
276
278
        self.assertEqual(t.get('path').read(), 'contentcontent')
277
279
 
278
280
    def test_put_and_get(self):
279
281
        t = memory.MemoryTransport()
280
 
        t.put_file('path', StringIO('content'))
 
282
        t.put_file('path', BytesIO(b'content'))
281
283
        self.assertEqual(t.get('path').read(), 'content')
282
284
        t.put_bytes('path', 'content')
283
285
        self.assertEqual(t.get('path').read(), 'content')
290
292
    def test_put_without_dir_fails(self):
291
293
        t = memory.MemoryTransport()
292
294
        self.assertRaises(errors.NoSuchFile,
293
 
                          t.put_file, 'dir/path', StringIO('content'))
 
295
                          t.put_file, 'dir/path', BytesIO(b'content'))
294
296
 
295
297
    def test_get_missing(self):
296
298
        transport = memory.MemoryTransport()