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

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2011-07-25 14:01:28 UTC
  • mfrom: (6039.1.9 transport-from-url)
  • Revision ID: pqm@pqm.ubuntu.com-20110725140128-croovh96z0rs57yy
(jelmer) Add get_transport_from_url and get_transport_from_path functions.
 (Jelmer Vernooij)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1161
1161
 
1162
1162
    def permit_dir(self, name):
1163
1163
        """Permit a directory to be used by this test. See permit_url."""
1164
 
        name_transport = _mod_transport.get_transport(name)
 
1164
        name_transport = _mod_transport.get_transport_from_path(name)
1165
1165
        self.permit_url(name)
1166
1166
        self.permit_url(name_transport.base)
1167
1167
 
1246
1246
        self.addCleanup(transport_server.stop_server)
1247
1247
        # Obtain a real transport because if the server supplies a password, it
1248
1248
        # will be hidden from the base on the client side.
1249
 
        t = _mod_transport.get_transport(transport_server.get_url())
 
1249
        t = _mod_transport.get_transport_from_url(transport_server.get_url())
1250
1250
        # Some transport servers effectively chroot the backing transport;
1251
1251
        # others like SFTPServer don't - users of the transport can walk up the
1252
1252
        # transport to read the entire backing transport. This wouldn't matter
2364
2364
 
2365
2365
        :param relpath: a path relative to the base url.
2366
2366
        """
2367
 
        t = _mod_transport.get_transport(self.get_url(relpath))
 
2367
        t = _mod_transport.get_transport_from_url(self.get_url(relpath))
2368
2368
        self.assertFalse(t.is_readonly())
2369
2369
        return t
2370
2370
 
2595
2595
            backing_server = self.get_server()
2596
2596
        smart_server = test_server.SmartTCPServer_for_testing()
2597
2597
        self.start_server(smart_server, backing_server)
2598
 
        remote_transport = _mod_transport.get_transport(smart_server.get_url()
 
2598
        remote_transport = _mod_transport.get_transport_from_url(smart_server.get_url()
2599
2599
                                                   ).clone(path)
2600
2600
        return remote_transport
2601
2601
 
2618
2618
    def setUp(self):
2619
2619
        super(TestCaseWithMemoryTransport, self).setUp()
2620
2620
        # Ensure that ConnectedTransport doesn't leak sockets
2621
 
        def get_transport_with_cleanup(*args, **kwargs):
2622
 
            t = orig_get_transport(*args, **kwargs)
 
2621
        def get_transport_from_url_with_cleanup(*args, **kwargs):
 
2622
            t = orig_get_transport_from_url(*args, **kwargs)
2623
2623
            if isinstance(t, _mod_transport.ConnectedTransport):
2624
2624
                self.addCleanup(t.disconnect)
2625
2625
            return t
2626
2626
 
2627
 
        orig_get_transport = self.overrideAttr(_mod_transport, 'get_transport',
2628
 
                                               get_transport_with_cleanup)
 
2627
        orig_get_transport_from_url = self.overrideAttr(
 
2628
            _mod_transport, 'get_transport_from_url',
 
2629
            get_transport_from_url_with_cleanup)
2629
2630
        self._make_test_root()
2630
2631
        self.addCleanup(os.chdir, os.getcwdu())
2631
2632
        self.makeAndChdirToTestDir()