~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_transport.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2006-07-10 02:16:27 UTC
  • mfrom: (1843.1.2 transport-errors)
  • Revision ID: pqm@pqm.ubuntu.com-20060710021627-47d5e48ecc36ece7
(jam) Give a better error when paramiko is not present (#47821, #52204)

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
                           TransportNotPossible,
26
26
                           ConnectionError,
27
27
                           DependencyNotPresent,
28
 
                           InvalidURL,
 
28
                           UnsupportedProtocol,
29
29
                           )
30
30
from bzrlib.tests import TestCase, TestCaseInTempDir
31
31
from bzrlib.transport import (_get_protocol_handlers,
71
71
        try:
72
72
            register_lazy_transport('foo', 'bzrlib.tests.test_transport',
73
73
                    'BadTransportHandler')
74
 
            # TODO: jam 20060427 Now we get InvalidURL because it looks like 
75
 
            #       a URL but we have no support for it.
76
 
            #       Is it better to always fall back to LocalTransport?
77
 
            #       I think this is a better error than a future NoSuchFile
78
 
            self.assertRaises(InvalidURL, get_transport, 'foo://fooserver/foo')
 
74
            try:
 
75
                get_transport('foo://fooserver/foo')
 
76
            except UnsupportedProtocol, e:
 
77
                e_str = str(e)
 
78
                self.assertEquals('Unsupported protocol'
 
79
                                  ' for url "foo://fooserver/foo":'
 
80
                                  ' Unable to import library "some_lib":'
 
81
                                  ' testing missing dependency', str(e))
 
82
            else:
 
83
                self.fail('Did not raise UnsupportedProtocol')
79
84
        finally:
80
85
            # restore original values
81
86
            _set_protocol_handlers(saved_handlers)