Exemplo n.º 1
0
 def test__get_set_protocol_handlers(self):
     handlers = _get_protocol_handlers()
     self.assertNotEqual([], handlers.keys( ))
     try:
         _clear_protocol_handlers()
         self.assertEqual([], _get_protocol_handlers().keys())
     finally:
         _set_protocol_handlers(handlers)
Exemplo n.º 2
0
 def test__get_set_protocol_handlers(self):
     handlers = _get_protocol_handlers()
     self.assertNotEqual([], handlers.keys())
     try:
         _clear_protocol_handlers()
         self.assertEqual([], _get_protocol_handlers().keys())
     finally:
         _set_protocol_handlers(handlers)
Exemplo n.º 3
0
 def test_transport_fallback(self):
     """Transport with missing dependency causes no error"""
     saved_handlers = transport._get_protocol_handlers()
     self.addCleanup(transport._set_protocol_handlers, saved_handlers)
     transport._clear_protocol_handlers()
     transport.register_transport_proto('foo')
     transport.register_lazy_transport(
         'foo', 'bzrlib.tests.test_transport', 'BackupTransportHandler')
     transport.register_lazy_transport(
         'foo', 'bzrlib.tests.test_transport', 'BadTransportHandler')
     t = transport.get_transport_from_url('foo://fooserver/foo')
     self.assertTrue(isinstance(t, BackupTransportHandler))
Exemplo n.º 4
0
 def test_transport_fallback(self):
     """Transport with missing dependency causes no error"""
     saved_handlers = transport._get_protocol_handlers()
     self.addCleanup(transport._set_protocol_handlers, saved_handlers)
     transport._clear_protocol_handlers()
     transport.register_transport_proto('foo')
     transport.register_lazy_transport('foo', 'bzrlib.tests.test_transport',
                                       'BackupTransportHandler')
     transport.register_lazy_transport('foo', 'bzrlib.tests.test_transport',
                                       'BadTransportHandler')
     t = transport.get_transport_from_url('foo://fooserver/foo')
     self.assertTrue(isinstance(t, BackupTransportHandler))
Exemplo n.º 5
0
 def test_transport_fallback(self):
     """Transport with missing dependency causes no error"""
     saved_handlers = _get_protocol_handlers()
     try:
         _clear_protocol_handlers()
         register_transport_proto('foo')
         register_lazy_transport('foo', 'bzrlib.tests.test_transport',
                                 'BackupTransportHandler')
         register_lazy_transport('foo', 'bzrlib.tests.test_transport',
                                 'BadTransportHandler')
         t = get_transport('foo://fooserver/foo')
         self.assertTrue(isinstance(t, BackupTransportHandler))
     finally:
         _set_protocol_handlers(saved_handlers)
Exemplo n.º 6
0
 def test_transport_fallback(self):
     """Transport with missing dependency causes no error"""
     saved_handlers = _get_protocol_handlers()
     try:
         _clear_protocol_handlers()
         register_transport_proto('foo')
         register_lazy_transport('foo', 'bzrlib.tests.test_transport',
                 'BackupTransportHandler')
         register_lazy_transport('foo', 'bzrlib.tests.test_transport',
                 'BadTransportHandler')
         t = get_transport('foo://fooserver/foo')
         self.assertTrue(isinstance(t, BackupTransportHandler))
     finally:
         _set_protocol_handlers(saved_handlers)
Exemplo n.º 7
0
 def test_transport_dependency(self):
     """Transport with missing dependency causes no error"""
     saved_handlers = transport._get_protocol_handlers()
     self.addCleanup(transport._set_protocol_handlers, saved_handlers)
     # don't pollute the current handlers
     transport._clear_protocol_handlers()
     transport.register_transport_proto('foo')
     transport.register_lazy_transport(
         'foo', 'bzrlib.tests.test_transport', 'BadTransportHandler')
     try:
         transport.get_transport_from_url('foo://fooserver/foo')
     except errors.UnsupportedProtocol, e:
         e_str = str(e)
         self.assertEquals('Unsupported protocol'
                             ' for url "foo://fooserver/foo":'
                             ' Unable to import library "some_lib":'
                             ' testing missing dependency', str(e))
Exemplo n.º 8
0
 def test_transport_dependency(self):
     """Transport with missing dependency causes no error"""
     saved_handlers = transport._get_protocol_handlers()
     self.addCleanup(transport._set_protocol_handlers, saved_handlers)
     # don't pollute the current handlers
     transport._clear_protocol_handlers()
     transport.register_transport_proto('foo')
     transport.register_lazy_transport('foo', 'bzrlib.tests.test_transport',
                                       'BadTransportHandler')
     try:
         transport.get_transport_from_url('foo://fooserver/foo')
     except errors.UnsupportedProtocol, e:
         e_str = str(e)
         self.assertEqual(
             'Unsupported protocol'
             ' for url "foo://fooserver/foo":'
             ' Unable to import library "some_lib":'
             ' testing missing dependency', str(e))
Exemplo n.º 9
0
 def test_get_transport_modules(self):
     handlers = _get_protocol_handlers()
     # don't pollute the current handlers
     _clear_protocol_handlers()
     class SampleHandler(object):
         """I exist, isnt that enough?"""
     try:
         _clear_protocol_handlers()
         register_transport_proto('foo')
         register_lazy_transport('foo', 'bzrlib.tests.test_transport',
                                 'TestTransport.SampleHandler')
         register_transport_proto('bar')
         register_lazy_transport('bar', 'bzrlib.tests.test_transport',
                                 'TestTransport.SampleHandler')
         self.assertEqual([SampleHandler.__module__,
                           'bzrlib.transport.chroot'],
                          _get_transport_modules())
     finally:
         _set_protocol_handlers(handlers)
Exemplo n.º 10
0
    def test_get_transport_modules(self):
        handlers = transport._get_protocol_handlers()
        self.addCleanup(transport._set_protocol_handlers, handlers)
        # don't pollute the current handlers
        transport._clear_protocol_handlers()

        class SampleHandler(object):
            """I exist, isnt that enough?"""

        transport._clear_protocol_handlers()
        transport.register_transport_proto('foo')
        transport.register_lazy_transport('foo', 'bzrlib.tests.test_transport',
                                          'TestTransport.SampleHandler')
        transport.register_transport_proto('bar')
        transport.register_lazy_transport('bar', 'bzrlib.tests.test_transport',
                                          'TestTransport.SampleHandler')
        self.assertEqual([
            SampleHandler.__module__, 'bzrlib.transport.chroot',
            'bzrlib.transport.pathfilter'
        ], transport._get_transport_modules())
Exemplo n.º 11
0
    def test_get_transport_modules(self):
        handlers = transport._get_protocol_handlers()
        self.addCleanup(transport._set_protocol_handlers, handlers)
        # don't pollute the current handlers
        transport._clear_protocol_handlers()

        class SampleHandler(object):
            """I exist, isnt that enough?"""
        transport._clear_protocol_handlers()
        transport.register_transport_proto('foo')
        transport.register_lazy_transport('foo',
                                            'bzrlib.tests.test_transport',
                                            'TestTransport.SampleHandler')
        transport.register_transport_proto('bar')
        transport.register_lazy_transport('bar',
                                            'bzrlib.tests.test_transport',
                                            'TestTransport.SampleHandler')
        self.assertEqual([SampleHandler.__module__,
                            'bzrlib.transport.chroot',
                            'bzrlib.transport.pathfilter'],
                            transport._get_transport_modules())
Exemplo n.º 12
0
    def test_get_transport_modules(self):
        handlers = _get_protocol_handlers()
        # don't pollute the current handlers
        _clear_protocol_handlers()

        class SampleHandler(object):
            """I exist, isnt that enough?"""

        try:
            _clear_protocol_handlers()
            register_transport_proto('foo')
            register_lazy_transport('foo', 'bzrlib.tests.test_transport',
                                    'TestTransport.SampleHandler')
            register_transport_proto('bar')
            register_lazy_transport('bar', 'bzrlib.tests.test_transport',
                                    'TestTransport.SampleHandler')
            self.assertEqual(
                [SampleHandler.__module__, 'bzrlib.transport.chroot'],
                _get_transport_modules())
        finally:
            _set_protocol_handlers(handlers)
Exemplo n.º 13
0
 def test__get_set_protocol_handlers(self):
     handlers = transport._get_protocol_handlers()
     self.assertNotEqual([], handlers.keys())
     transport._clear_protocol_handlers()
     self.addCleanup(transport._set_protocol_handlers, handlers)
     self.assertEqual([], transport._get_protocol_handlers().keys())
Exemplo n.º 14
0
 def test__get_set_protocol_handlers(self):
     handlers = transport._get_protocol_handlers()
     self.assertNotEqual([], handlers.keys())
     transport._clear_protocol_handlers()
     self.addCleanup(transport._set_protocol_handlers, handlers)
     self.assertEqual([], transport._get_protocol_handlers().keys())