~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_transport.py

[merge] bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
 
21
21
from bzrlib.errors import (NoSuchFile, FileExists, TransportNotPossible,
22
22
                           ConnectionError)
23
 
from bzrlib.selftest import TestCase, TestCaseInTempDir
24
 
from bzrlib.selftest.HTTPTestUtil import TestCaseWithWebserver
 
23
from bzrlib.tests import TestCase, TestCaseInTempDir
 
24
from bzrlib.tests.HTTPTestUtil import TestCaseWithWebserver
25
25
from bzrlib.transport import memory, urlescape
26
26
 
27
27
 
287
287
        files = ['a', 'b', 'c', 'd']
288
288
        self.build_tree(files)
289
289
 
290
 
        dtmp = tempfile.mkdtemp(dir='.', prefix='test-transport-')
 
290
        dtmp = tempfile.mkdtemp(dir=u'.', prefix='test-transport-')
291
291
        dtmp_base = os.path.basename(dtmp)
292
292
        local_t = LocalTransport(dtmp)
293
293
 
307
307
 
308
308
        del dtmp, dtmp_base, local_t
309
309
 
310
 
        dtmp = tempfile.mkdtemp(dir='.', prefix='test-transport-')
 
310
        dtmp = tempfile.mkdtemp(dir=u'.', prefix='test-transport-')
311
311
        dtmp_base = os.path.basename(dtmp)
312
312
        local_t = LocalTransport(dtmp)
313
313
 
473
473
        if not hasattr(self, "get_bogus_transport"):
474
474
            return
475
475
        t = self.get_bogus_transport()
476
 
        self.assertRaises(ConnectionError, t.get, '.bzr/branch')
 
476
        try:
 
477
            t.get('.bzr/branch')
 
478
        except (ConnectionError, NoSuchFile), e:
 
479
            pass
 
480
        except (Exception), e:
 
481
            self.failIf(True, 'Wrong exception thrown: %s' % e)
 
482
        else:
 
483
            self.failIf(True, 'Did not get the expected exception.')
477
484
 
478
485
        
479
486
class LocalTransportTest(TestCaseInTempDir, TestTransportMixIn):
480
487
    def get_transport(self):
481
488
        from bzrlib.transport.local import LocalTransport
482
 
        return LocalTransport('.')
 
489
        return LocalTransport(u'.')
483
490
 
484
491
 
485
492
class HttpTransportTest(TestCaseWithWebserver, TestTransportMixIn):
488
495
 
489
496
    def get_transport(self):
490
497
        from bzrlib.transport.http import HttpTransport
491
 
        url = self.get_remote_url('.')
 
498
        url = self.get_remote_url(u'.')
492
499
        return HttpTransport(url)
493
500
 
494
501
    def get_bogus_transport(self):