[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:
hpk 2009-03-18 13:05:18 +01:00
parent 87cd94a197
commit 772658d616
7 changed files with 16 additions and 12 deletions

View File

@ -140,7 +140,7 @@ To specify Gateways with a String::
>>> gwspec = py.execnet.GatewaySpec("popen")
>>> gw = gwspec.makegateway()
>>> 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

View File

@ -24,7 +24,7 @@ from py.__.execnet.channel import RemoteError
NO_ENDMARKER_WANTED = object()
class GatewaySpec(object):
python = "python"
python = None
def __init__(self, spec, defaultjoinpath="pyexecnetcache"):
if spec == "popen" or spec.startswith("popen:"):
parts = spec.split(":", 2)
@ -35,6 +35,9 @@ class GatewaySpec(object):
self.joinpath = parts.pop(0)
else:
self.joinpath = ""
if not self.python:
self.python = py.std.sys.executable
elif spec.startswith("socket:"):
parts = spec[7:].split(":", 2)
self.address = parts.pop(0)

View File

@ -6,7 +6,11 @@ from py.__.test import event
def getconfiggwspecs(config):
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:
gwspecs = config.option.gateways
if not gwspecs:

View File

@ -120,11 +120,8 @@ class SlaveNode(object):
self.sendevent("itemtestreport", testrep)
def makehostup(host=None):
from py.__.execnet.gwmanage import GatewaySpec
def makehostup(host="INPROCESS"):
import sys
if host is None:
host = GatewaySpec("localhost")
platinfo = {}
for name in 'platform', 'executable', 'version_info':
platinfo["sys."+name] = getattr(sys, name)

View File

@ -232,7 +232,7 @@ class TmpTestdir:
else:
script = bindir.join(scriptname)
assert script.check()
return self.run(script, *args)
return self.run(py.std.sys.executable, script, *args)
def runpytest(self, *args):
p = py.path.local.make_numbered_dir(prefix="runpytest-",

View File

@ -98,7 +98,7 @@ class TerminalReporter:
def pyevent_hostup(self, event):
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'])
self.write_line("HOSTUP: %(host)s %(sys.platform)s "
"%(sys.executable)s - Python %(version)s" %
@ -325,7 +325,7 @@ class TestTerminal:
rep = TerminalReporter(item.config, linecomp.stringio)
rep.pyevent_hostup(makehostup())
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))
])

View File

@ -179,7 +179,7 @@ class TestPyTest:
verinfo = ".".join(map(str, py.std.sys.version_info[:3]))
extra = result.stdout.fnmatch_lines([
"*===== test session starts ====*",
"*localhost* %s %s - Python %s*" %(
"HOSTUP*INPROCESS* %s %s - Python %s*" %(
py.std.sys.platform, py.std.sys.executable, verinfo),
"*test_header_trailer_info.py .",
"=* 1 passed in *.[0-9][0-9] seconds *=",
@ -379,7 +379,7 @@ class TestInteractive:
return spawn
def requirespexpect(self, version_needed):
import pexpect
pexpect = py.test.importorskip("pexpect")
ver = tuple(map(int, pexpect.__version__.split(".")))
if ver < version_needed:
py.test.skip("pexpect version %s needed" %(".".join(map(str, version_needed))))