~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transport/sftp.py

  • Committer: Martin Pool
  • Date: 2009-11-16 02:26:32 UTC
  • mto: This revision was merged to the branch mainline in revision 4880.
  • Revision ID: mbp@sourcefrog.net-20091116022632-261trs2osy8oupe3
Convert version-info to use TextUIOutputStream

Show diffs side-by-side

added added

removed removed

Lines of Context:
917
917
        self._socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
918
918
        self._socket.bind(('localhost', 0))
919
919
        self._socket.listen(1)
920
 
        self.host, self.port = self._socket.getsockname()[:2]
 
920
        self.port = self._socket.getsockname()[1]
921
921
        self._stop_event = threading.Event()
922
922
 
923
923
    def stop(self):
1045
1045
 
1046
1046
    def _get_sftp_url(self, path):
1047
1047
        """Calculate an sftp url to this server for path."""
1048
 
        return 'sftp://foo:bar@%s:%d/%s' % (self._listener.host,
1049
 
                                            self._listener.port, path)
 
1048
        return 'sftp://foo:bar@localhost:%d/%s' % (self._listener.port, path)
1050
1049
 
1051
1050
    def log(self, message):
1052
1051
        """StubServer uses this to log when a new server is created."""
1078
1077
        ssh_server.start_server(event, server)
1079
1078
        event.wait(5.0)
1080
1079
 
1081
 
    def start_server(self, backing_server=None):
 
1080
    def setUp(self, backing_server=None):
1082
1081
        # XXX: TODO: make sftpserver back onto backing_server rather than local
1083
1082
        # disk.
1084
1083
        if not (backing_server is None or
1103
1102
        self._listener.setDaemon(True)
1104
1103
        self._listener.start()
1105
1104
 
1106
 
    def stop_server(self):
 
1105
    def tearDown(self):
 
1106
        """See bzrlib.transport.Server.tearDown."""
1107
1107
        self._listener.stop()
1108
1108
        ssh._ssh_vendor_manager._cached_ssh_vendor = self._original_vendor
1109
1109
 
1202
1202
    It does this by serving from a deeply-nested directory that doesn't exist.
1203
1203
    """
1204
1204
 
1205
 
    def start_server(self, backing_server=None):
 
1205
    def setUp(self, backing_server=None):
1206
1206
        self._server_homedir = '/dev/noone/runs/tests/here'
1207
 
        super(SFTPSiblingAbsoluteServer, self).start_server(backing_server)
 
1207
        super(SFTPSiblingAbsoluteServer, self).setUp(backing_server)
1208
1208
 
1209
1209
 
1210
1210
def get_test_permutations():