[svn r63028] allow py.test --exec=python2.4 -n 3 to work
and fix some bugs from doing so. --HG-- branch : trunk
This commit is contained in:
parent
87cd94a197
commit
772658d616
|
@ -140,7 +140,7 @@ To specify Gateways with a String::
|
||||||
>>> gwspec = py.execnet.GatewaySpec("popen")
|
>>> gwspec = py.execnet.GatewaySpec("popen")
|
||||||
>>> gw = gwspec.makegateway()
|
>>> gw = gwspec.makegateway()
|
||||||
>>> ex = gw.remote_exec("import sys ; channel.send(sys.executable)").receive()
|
>>> ex = gw.remote_exec("import sys ; channel.send(sys.executable)").receive()
|
||||||
>>> assert ex == py.std.sys.executable
|
>>> assert ex == py.std.sys.executable, (ex, py.std.sys.executable)
|
||||||
>>>
|
>>>
|
||||||
|
|
||||||
current gateway types and specifications
|
current gateway types and specifications
|
||||||
|
|
|
@ -24,7 +24,7 @@ from py.__.execnet.channel import RemoteError
|
||||||
NO_ENDMARKER_WANTED = object()
|
NO_ENDMARKER_WANTED = object()
|
||||||
|
|
||||||
class GatewaySpec(object):
|
class GatewaySpec(object):
|
||||||
python = "python"
|
python = None
|
||||||
def __init__(self, spec, defaultjoinpath="pyexecnetcache"):
|
def __init__(self, spec, defaultjoinpath="pyexecnetcache"):
|
||||||
if spec == "popen" or spec.startswith("popen:"):
|
if spec == "popen" or spec.startswith("popen:"):
|
||||||
parts = spec.split(":", 2)
|
parts = spec.split(":", 2)
|
||||||
|
@ -35,6 +35,9 @@ class GatewaySpec(object):
|
||||||
self.joinpath = parts.pop(0)
|
self.joinpath = parts.pop(0)
|
||||||
else:
|
else:
|
||||||
self.joinpath = ""
|
self.joinpath = ""
|
||||||
|
if not self.python:
|
||||||
|
self.python = py.std.sys.executable
|
||||||
|
|
||||||
elif spec.startswith("socket:"):
|
elif spec.startswith("socket:"):
|
||||||
parts = spec[7:].split(":", 2)
|
parts = spec[7:].split(":", 2)
|
||||||
self.address = parts.pop(0)
|
self.address = parts.pop(0)
|
||||||
|
|
|
@ -6,7 +6,11 @@ from py.__.test import event
|
||||||
|
|
||||||
def getconfiggwspecs(config):
|
def getconfiggwspecs(config):
|
||||||
if config.option.numprocesses:
|
if config.option.numprocesses:
|
||||||
gwspecs = ['popen'] * config.option.numprocesses
|
if config.option.executable:
|
||||||
|
s = 'popen:%s' % config.option.executable
|
||||||
|
else:
|
||||||
|
s = 'popen'
|
||||||
|
gwspecs = [s] * config.option.numprocesses
|
||||||
else:
|
else:
|
||||||
gwspecs = config.option.gateways
|
gwspecs = config.option.gateways
|
||||||
if not gwspecs:
|
if not gwspecs:
|
||||||
|
|
|
@ -120,11 +120,8 @@ class SlaveNode(object):
|
||||||
self.sendevent("itemtestreport", testrep)
|
self.sendevent("itemtestreport", testrep)
|
||||||
|
|
||||||
|
|
||||||
def makehostup(host=None):
|
def makehostup(host="INPROCESS"):
|
||||||
from py.__.execnet.gwmanage import GatewaySpec
|
|
||||||
import sys
|
import sys
|
||||||
if host is None:
|
|
||||||
host = GatewaySpec("localhost")
|
|
||||||
platinfo = {}
|
platinfo = {}
|
||||||
for name in 'platform', 'executable', 'version_info':
|
for name in 'platform', 'executable', 'version_info':
|
||||||
platinfo["sys."+name] = getattr(sys, name)
|
platinfo["sys."+name] = getattr(sys, name)
|
||||||
|
|
|
@ -232,7 +232,7 @@ class TmpTestdir:
|
||||||
else:
|
else:
|
||||||
script = bindir.join(scriptname)
|
script = bindir.join(scriptname)
|
||||||
assert script.check()
|
assert script.check()
|
||||||
return self.run(script, *args)
|
return self.run(py.std.sys.executable, script, *args)
|
||||||
|
|
||||||
def runpytest(self, *args):
|
def runpytest(self, *args):
|
||||||
p = py.path.local.make_numbered_dir(prefix="runpytest-",
|
p = py.path.local.make_numbered_dir(prefix="runpytest-",
|
||||||
|
|
|
@ -98,7 +98,7 @@ class TerminalReporter:
|
||||||
|
|
||||||
def pyevent_hostup(self, event):
|
def pyevent_hostup(self, event):
|
||||||
d = event.platinfo.copy()
|
d = event.platinfo.copy()
|
||||||
d['host'] = event.host.address
|
d['host'] = getattr(event.host, 'address', event.host)
|
||||||
d['version'] = repr_pythonversion(d['sys.version_info'])
|
d['version'] = repr_pythonversion(d['sys.version_info'])
|
||||||
self.write_line("HOSTUP: %(host)s %(sys.platform)s "
|
self.write_line("HOSTUP: %(host)s %(sys.platform)s "
|
||||||
"%(sys.executable)s - Python %(version)s" %
|
"%(sys.executable)s - Python %(version)s" %
|
||||||
|
@ -325,7 +325,7 @@ class TestTerminal:
|
||||||
rep = TerminalReporter(item.config, linecomp.stringio)
|
rep = TerminalReporter(item.config, linecomp.stringio)
|
||||||
rep.pyevent_hostup(makehostup())
|
rep.pyevent_hostup(makehostup())
|
||||||
linecomp.assert_contains_lines([
|
linecomp.assert_contains_lines([
|
||||||
"*localhost %s %s - Python %s" %(sys.platform,
|
"*inline %s %s - Python %s" %(sys.platform,
|
||||||
sys.executable, repr_pythonversion(sys.version_info))
|
sys.executable, repr_pythonversion(sys.version_info))
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
|
@ -179,7 +179,7 @@ class TestPyTest:
|
||||||
verinfo = ".".join(map(str, py.std.sys.version_info[:3]))
|
verinfo = ".".join(map(str, py.std.sys.version_info[:3]))
|
||||||
extra = result.stdout.fnmatch_lines([
|
extra = result.stdout.fnmatch_lines([
|
||||||
"*===== test session starts ====*",
|
"*===== test session starts ====*",
|
||||||
"*localhost* %s %s - Python %s*" %(
|
"HOSTUP*INPROCESS* %s %s - Python %s*" %(
|
||||||
py.std.sys.platform, py.std.sys.executable, verinfo),
|
py.std.sys.platform, py.std.sys.executable, verinfo),
|
||||||
"*test_header_trailer_info.py .",
|
"*test_header_trailer_info.py .",
|
||||||
"=* 1 passed in *.[0-9][0-9] seconds *=",
|
"=* 1 passed in *.[0-9][0-9] seconds *=",
|
||||||
|
@ -379,7 +379,7 @@ class TestInteractive:
|
||||||
return spawn
|
return spawn
|
||||||
|
|
||||||
def requirespexpect(self, version_needed):
|
def requirespexpect(self, version_needed):
|
||||||
import pexpect
|
pexpect = py.test.importorskip("pexpect")
|
||||||
ver = tuple(map(int, pexpect.__version__.split(".")))
|
ver = tuple(map(int, pexpect.__version__.split(".")))
|
||||||
if ver < version_needed:
|
if ver < version_needed:
|
||||||
py.test.skip("pexpect version %s needed" %(".".join(map(str, version_needed))))
|
py.test.skip("pexpect version %s needed" %(".".join(map(str, version_needed))))
|
||||||
|
|
Loading…
Reference in New Issue