~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transport/smart.py

  • Committer: Martin Pool
  • Date: 2007-04-04 01:22:11 UTC
  • mfrom: (2393.1.1 bzr.docs)
  • mto: This revision was merged to the branch mainline in revision 2397.
  • Revision ID: mbp@sourcefrog.net-20070404012211-sq269me6bai9m6xk
merge trunk and doc fix from elliot

Show diffs side-by-side

added added

removed removed

Lines of Context:
903
903
        SmartTCPServer.__init__(self,
904
904
            transport.get_transport(urlutils.local_path_to_url('/')))
905
905
        
906
 
    def setUp(self):
 
906
    def get_backing_transport(self, backing_transport_server):
 
907
        """Get a backing transport from a server we are decorating."""
 
908
        return transport.get_transport(backing_transport_server.get_url())
 
909
 
 
910
    def setUp(self, backing_transport_server=None):
907
911
        """Set up server for testing"""
 
912
        from bzrlib.transport.chroot import TestingChrootServer
 
913
        if backing_transport_server is None:
 
914
            from bzrlib.transport.local import LocalURLServer
 
915
            backing_transport_server = LocalURLServer()
 
916
        self.chroot_server = TestingChrootServer()
 
917
        self.chroot_server.setUp(backing_transport_server)
 
918
        self.backing_transport = transport.get_transport(
 
919
            self.chroot_server.get_url())
908
920
        self.start_background_thread()
909
921
 
910
922
    def tearDown(self):
911
923
        self.stop_background_thread()
912
924
 
913
 
    def get_url(self):
914
 
        """Return the url of the server"""
915
 
        host, port = self._server_socket.getsockname()
916
 
        return "bzr://%s:%d%s" % (host, port, urlutils.escape(self._homedir))
917
 
 
918
925
    def get_bogus_url(self):
919
926
        """Return a URL which will fail to connect"""
920
927
        return 'bzr://127.0.0.1:1/'