[svn r37459] fix socketgateway test to run on both win32 and linux
--HG-- branch : trunk
This commit is contained in:
parent
e64d602cd2
commit
6838180187
|
@ -145,7 +145,7 @@ class SocketGateway(InstallableGateway):
|
||||||
given gateway.
|
given gateway.
|
||||||
"""
|
"""
|
||||||
if hostport is None:
|
if hostport is None:
|
||||||
host, port = ('', 0)
|
host, port = ('', 0) # XXX works on all platforms?
|
||||||
else:
|
else:
|
||||||
host, port = hostport
|
host, port = hostport
|
||||||
socketserverbootstrap = py.code.Source(
|
socketserverbootstrap = py.code.Source(
|
||||||
|
@ -153,18 +153,16 @@ class SocketGateway(InstallableGateway):
|
||||||
"""
|
"""
|
||||||
import socket
|
import socket
|
||||||
sock = bind_and_listen((%r, %r))
|
sock = bind_and_listen((%r, %r))
|
||||||
hostname = socket.gethostname()
|
port = sock.getsockname()
|
||||||
channel.send((hostname, sock.getsockname()))
|
channel.send(port)
|
||||||
startserver(sock)
|
startserver(sock)
|
||||||
""" % (host, port))
|
""" % (host, port))
|
||||||
# execute the above socketserverbootstrap on the other side
|
# execute the above socketserverbootstrap on the other side
|
||||||
channel = gateway.remote_exec(socketserverbootstrap)
|
channel = gateway.remote_exec(socketserverbootstrap)
|
||||||
hostname, (realhost, realport) = channel.receive()
|
(realhost, realport) = channel.receive()
|
||||||
if not hostname:
|
|
||||||
hostname = realhost
|
|
||||||
#gateway._trace("remote_install received"
|
#gateway._trace("remote_install received"
|
||||||
# "port=%r, hostname = %r" %(realport, hostname))
|
# "port=%r, hostname = %r" %(realport, hostname))
|
||||||
return py.execnet.SocketGateway(hostname, realport)
|
return py.execnet.SocketGateway(host, realport)
|
||||||
remote_install = classmethod(remote_install)
|
remote_install = classmethod(remote_install)
|
||||||
|
|
||||||
class SshGateway(PopenCmdGateway):
|
class SshGateway(PopenCmdGateway):
|
||||||
|
|
|
@ -437,7 +437,9 @@ class SocketGatewaySetup:
|
||||||
def setup_class(cls):
|
def setup_class(cls):
|
||||||
# open a gateway to a fresh child process
|
# open a gateway to a fresh child process
|
||||||
cls.proxygw = py.execnet.PopenGateway()
|
cls.proxygw = py.execnet.PopenGateway()
|
||||||
cls.gw = py.execnet.SocketGateway.remote_install(cls.proxygw)
|
cls.gw = py.execnet.SocketGateway.remote_install(cls.proxygw,
|
||||||
|
("127.0.0.1", 0)
|
||||||
|
)
|
||||||
|
|
||||||
## def teardown_class(cls):
|
## def teardown_class(cls):
|
||||||
## cls.gw.exit()
|
## cls.gw.exit()
|
||||||
|
|
Loading…
Reference in New Issue