make looponfailing a bit more robust against relative imports and changed directories - needs more work, probably.
--HG-- branch : trunk
This commit is contained in:
parent
79af98fc29
commit
c348cec481
|
@ -62,22 +62,22 @@ class RemoteControl(object):
|
||||||
if hasattr(self, 'gateway'):
|
if hasattr(self, 'gateway'):
|
||||||
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")
|
||||||
old = self.config.topdir.chdir()
|
self.gateway = self.initgateway()
|
||||||
try:
|
channel = self.gateway.remote_exec("""
|
||||||
self.gateway = self.initgateway()
|
import os
|
||||||
finally:
|
|
||||||
old.chdir()
|
|
||||||
channel = self.gateway.remote_exec(source="""
|
|
||||||
from py.impl.test.dist.mypickle import PickleChannel
|
from py.impl.test.dist.mypickle import PickleChannel
|
||||||
from py.impl.test.looponfail.remote import slave_runsession
|
from py.impl.test.looponfail.remote import slave_runsession
|
||||||
|
chdir = channel.receive()
|
||||||
outchannel = channel.gateway.newchannel()
|
outchannel = channel.gateway.newchannel()
|
||||||
channel.send(outchannel)
|
channel.send(outchannel)
|
||||||
channel = PickleChannel(channel)
|
channel = PickleChannel(channel)
|
||||||
|
os.chdir(chdir) # unpickling config uses cwd as topdir
|
||||||
config, fullwidth, hasmarkup = channel.receive()
|
config, fullwidth, hasmarkup = channel.receive()
|
||||||
import sys
|
import sys
|
||||||
sys.stdout = sys.stderr = outchannel.makefile('w')
|
sys.stdout = sys.stderr = outchannel.makefile('w')
|
||||||
slave_runsession(channel, config, fullwidth, hasmarkup)
|
slave_runsession(channel, config, fullwidth, hasmarkup)
|
||||||
""")
|
""")
|
||||||
|
channel.send(str(self.config.topdir))
|
||||||
remote_outchannel = channel.receive()
|
remote_outchannel = channel.receive()
|
||||||
def write(s):
|
def write(s):
|
||||||
out._file.write(s)
|
out._file.write(s)
|
||||||
|
|
|
@ -16,7 +16,6 @@ class TestConfigCmdlineParsing:
|
||||||
help='t value'),
|
help='t value'),
|
||||||
)
|
)
|
||||||
""")
|
""")
|
||||||
testdir.chdir()
|
|
||||||
config = testdir.reparseconfig(['-G', '17'])
|
config = testdir.reparseconfig(['-G', '17'])
|
||||||
assert config.option.gdest == 17
|
assert config.option.gdest == 17
|
||||||
|
|
||||||
|
@ -46,19 +45,6 @@ class TestConfigCmdlineParsing:
|
||||||
config = testdir.parseconfig()
|
config = testdir.parseconfig()
|
||||||
assert config.option.verbose
|
assert config.option.verbose
|
||||||
|
|
||||||
def test_config_cmdline_options_only_lowercase(self, testdir):
|
|
||||||
testdir.makepyfile(conftest="""
|
|
||||||
import py
|
|
||||||
Option = py.test.config.Option
|
|
||||||
options = py.test.config.addoptions("testing group",
|
|
||||||
Option('-g', '--glong', action="store", default=42,
|
|
||||||
type="int", dest="gdest", help="g value."),
|
|
||||||
)
|
|
||||||
""")
|
|
||||||
py.test.raises(ValueError, """
|
|
||||||
testdir.reparseconfig(['-g', '17'])
|
|
||||||
""")
|
|
||||||
|
|
||||||
def test_parsing_again_fails(self, testdir):
|
def test_parsing_again_fails(self, testdir):
|
||||||
config = testdir.reparseconfig([testdir.tmpdir])
|
config = testdir.reparseconfig([testdir.tmpdir])
|
||||||
py.test.raises(AssertionError, "config.parse([])")
|
py.test.raises(AssertionError, "config.parse([])")
|
||||||
|
|
Loading…
Reference in New Issue