remove the PickleChannel dependency for looponfail

--HG--
branch : trunk
This commit is contained in:
Ronny Pfannschmidt 2010-01-12 17:35:06 +01:00
parent a9fe84d9b9
commit 676081b87a
2 changed files with 14 additions and 11 deletions

View File

@ -114,7 +114,7 @@ class Config(object):
for path in self.args: for path in self.args:
path = py.path.local(path) path = py.path.local(path)
l.append(path.relto(self.topdir)) l.append(path.relto(self.topdir))
return l, self.option return l, vars(self.option)
def __setstate__(self, repr): def __setstate__(self, repr):
# we have to set py.test.config because loading # we have to set py.test.config because loading
@ -126,7 +126,8 @@ class Config(object):
self._rootcol = RootCollector(config=self) self._rootcol = RootCollector(config=self)
args, cmdlineopts = repr args, cmdlineopts = repr
args = [str(self.topdir.join(x)) for x in args] args = [str(self.topdir.join(x)) for x in args]
self.option = cmdlineopts self.option = CmdOptions()
self.option.__dict__.update(cmdlineopts)
self._preparse(args) self._preparse(args)
self._setargs(args) self._setargs(args)

View File

@ -11,7 +11,6 @@ import py
import sys import sys
import execnet import execnet
from py.impl.test.session import Session from py.impl.test.session import Session
from py.impl.test.dist.mypickle import PickleChannel
from py.impl.test.looponfail import util from py.impl.test.looponfail import util
class LooponfailingSession(Session): class LooponfailingSession(Session):
@ -63,19 +62,22 @@ class RemoteControl(object):
raise ValueError("already have gateway %r" % self.gateway) raise ValueError("already have gateway %r" % self.gateway)
self.trace("setting up slave session") self.trace("setting up slave session")
self.gateway = self.initgateway() self.gateway = self.initgateway()
channel = self.gateway.remote_exec(""" self.channel = channel = self.gateway.remote_exec("""
import os import os
from py.impl.test.dist.mypickle import PickleChannel import py
from py.impl.test.looponfail.remote import slave_runsession
chdir = channel.receive() chdir = channel.receive()
outchannel = channel.gateway.newchannel() outchannel = channel.gateway.newchannel()
channel.send(outchannel) channel.send(outchannel)
channel = PickleChannel(channel)
os.chdir(chdir) # unpickling config uses cwd as topdir os.chdir(chdir) # unpickling config uses cwd as topdir
config, fullwidth, hasmarkup = channel.receive() config_state = channel.receive()
fullwidth, hasmarkup = channel.receive()
py.test.config.__setstate__(config_state)
import sys import sys
sys.stdout = sys.stderr = outchannel.makefile('w') sys.stdout = sys.stderr = outchannel.makefile('w')
slave_runsession(channel, config, fullwidth, hasmarkup)
from py.impl.test.looponfail.remote import slave_runsession
slave_runsession(channel, py.test.config, fullwidth, hasmarkup)
""") """)
channel.send(str(self.config.topdir)) channel.send(str(self.config.topdir))
remote_outchannel = channel.receive() remote_outchannel = channel.receive()
@ -83,8 +85,8 @@ class RemoteControl(object):
out._file.write(s) out._file.write(s)
out._file.flush() out._file.flush()
remote_outchannel.setcallback(write) remote_outchannel.setcallback(write)
channel = self.channel = PickleChannel(channel) channel.send(self.config.__getstate__())
channel.send((self.config, out.fullwidth, out.hasmarkup)) channel.send((out.fullwidth, out.hasmarkup))
self.trace("set up of slave session complete") self.trace("set up of slave session complete")
def ensure_teardown(self): def ensure_teardown(self):