[svn r37443] slightly re-organizing RemoteTerminalSession for

easier subclassing.

--HG--
branch : trunk
This commit is contained in:
hpk 2007-01-27 19:41:39 +01:00
parent a1171a8726
commit 3d70646122
1 changed files with 17 additions and 7 deletions

View File

@ -90,30 +90,40 @@ class RemoteTerminalSession(object):
print "# ", "^" * len(str(rootdir)) print "# ", "^" * len(str(rootdir))
return failures return failures
def run_remote_session(self, failures): def _initslavegateway(self):
print "* opening PopenGateway: ", self.executable print "* opening PopenGateway: ", self.executable
gw = py.execnet.PopenGateway(self.executable) topdir = self.config.topdir
return py.execnet.PopenGateway(self.executable), topdir
def run_remote_session(self, failures):
gw, topdir = self._initslavegateway()
channel = gw.remote_exec(""" channel = gw.remote_exec("""
from py.__.test.terminal.remote import slaverun_TerminalSession from py.__.test.terminal.remote import slaverun_TerminalSession
slaverun_TerminalSession(channel) slaverun_TerminalSession(channel)
""", stdout=self.out, stderr=self.out) """, stdout=self.out, stderr=self.out)
print "MASTER: triggered slave terminal session ->" print "MASTER: initiated slave terminal session ->"
repr = self.config.make_repr(conftestnames=[]) repr = self.config.make_repr(conftestnames=[])
channel.send((str(self.config.topdir), repr, failures)) channel.send((str(topdir), repr, failures))
print "MASTER: send start info" print "MASTER: send start info, topdir=%s" % (topdir,)
try: try:
return channel.receive() return channel.receive()
except channel.RemoteError, e: except channel.RemoteError, e:
print "*" * 70
print "ERROR while waiting for proper slave startup"
print "*" * 70
print e print e
return [] return []
def slaverun_TerminalSession(channel): def slaverun_TerminalSession(channel):
""" we run this on the other side. """ """ we run this on the other side. """
print "SLAVE: starting" print "SLAVE: initializing ..."
topdir, repr, failures = channel.receive() topdir, repr, failures = channel.receive()
print "SLAVE: received configuration" print "SLAVE: received configuration, using topdir:", topdir
config = py.test.config config = py.test.config
import sys
sys.stdout.flush()
config.initdirect(topdir, repr, failures) config.initdirect(topdir, repr, failures)
config.option.session = None
config.option.looponfailing = False config.option.looponfailing = False
config.option.usepdb = False config.option.usepdb = False
config.option.executable = None config.option.executable = None