fix and test bug: dist-testing now works again without execnet/pylib installed remotely. fixes issue65.
--HG-- branch : trunk
This commit is contained in:
parent
3a23baf484
commit
352e305431
|
@ -62,6 +62,9 @@ Changes between 1.X and 1.1.1
|
||||||
|
|
||||||
- fix assert reinterpreation that sees a call containing "keyword=..."
|
- fix assert reinterpreation that sees a call containing "keyword=..."
|
||||||
|
|
||||||
|
- fix issue65: properly handle dist-testing if no
|
||||||
|
execnet/py lib installed remotely.
|
||||||
|
|
||||||
- skip some install-tests if no execnet is available
|
- skip some install-tests if no execnet is available
|
||||||
|
|
||||||
- fix docs, fix internal bin/ script generation
|
- fix docs, fix internal bin/ script generation
|
||||||
|
|
|
@ -42,15 +42,6 @@ test: testing/pytest/dist/test_dsession.py - test_terminate_on_hanging_node
|
||||||
Call gateway group termination with a small timeout if available.
|
Call gateway group termination with a small timeout if available.
|
||||||
Should make dist-testing less likely to leave lost processes.
|
Should make dist-testing less likely to leave lost processes.
|
||||||
|
|
||||||
fix dist-testing: execnet needs to be rsynced over automatically
|
|
||||||
------------------------------------------------------------------
|
|
||||||
|
|
||||||
tags: bug 1.2
|
|
||||||
bb: http://bitbucket.org/hpk42/py-trunk/issue/65/
|
|
||||||
|
|
||||||
execnet is not rsynced so fails if run in an ssh-situation.
|
|
||||||
write test and fix.
|
|
||||||
|
|
||||||
dist-testing: fix session hook / setup calling
|
dist-testing: fix session hook / setup calling
|
||||||
-----------------------------------------------------
|
-----------------------------------------------------
|
||||||
tags: bug 1.2
|
tags: bug 1.2
|
||||||
|
|
|
@ -174,3 +174,52 @@ def test_cmdline_entrypoints(monkeypatch):
|
||||||
assert expected in points
|
assert expected in points
|
||||||
for script in unversioned_scripts:
|
for script in unversioned_scripts:
|
||||||
assert script in points
|
assert script in points
|
||||||
|
|
||||||
|
def test_slave_popen_needs_no_pylib(testdir, venv):
|
||||||
|
venv.ensure()
|
||||||
|
#xxx execnet optimizes popen
|
||||||
|
#ch = venv.makegateway().remote_exec("import execnet")
|
||||||
|
#py.test.raises(ch.RemoteError, ch.waitclose)
|
||||||
|
python = venv._cmd("python")
|
||||||
|
p = testdir.makepyfile("""
|
||||||
|
import py
|
||||||
|
def test_func():
|
||||||
|
pass
|
||||||
|
""")
|
||||||
|
result = testdir.runpytest(p, '--rsyncdir=%s' % str(p),
|
||||||
|
'--dist=each', '--tx=popen//python=%s' % python)
|
||||||
|
result.stdout.fnmatch_lines([
|
||||||
|
"*1 passed*"
|
||||||
|
])
|
||||||
|
|
||||||
|
def test_slave_needs_no_execnet(testdir, specssh):
|
||||||
|
gw = execnet.makegateway(specssh)
|
||||||
|
ch = gw.remote_exec("""
|
||||||
|
import os, subprocess
|
||||||
|
subprocess.call(["virtualenv", "--no-site-packages", "subdir"])
|
||||||
|
channel.send(os.path.join(os.path.abspath("subdir"), 'bin', 'python'))
|
||||||
|
channel.send(os.path.join(os.path.abspath("subdir")))
|
||||||
|
""")
|
||||||
|
try:
|
||||||
|
path = ch.receive()
|
||||||
|
chdir = ch.receive()
|
||||||
|
except ch.RemoteError:
|
||||||
|
e = sys.exc_info()[1]
|
||||||
|
py.test.skip("could not prepare ssh slave:%s" % str(e))
|
||||||
|
gw.exit()
|
||||||
|
newspec = "%s//python=%s//chdir=%s" % (specssh, path, chdir)
|
||||||
|
gw = execnet.makegateway(newspec)
|
||||||
|
ch = gw.remote_exec("import execnet")
|
||||||
|
py.test.raises(ch.RemoteError, ch.waitclose)
|
||||||
|
gw.exit()
|
||||||
|
|
||||||
|
p = testdir.makepyfile("""
|
||||||
|
import py
|
||||||
|
def test_func():
|
||||||
|
pass
|
||||||
|
""")
|
||||||
|
result = testdir.runpytest(p, '--rsyncdir=%s' % str(p),
|
||||||
|
'--dist=each', '--tx=%s' % newspec)
|
||||||
|
result.stdout.fnmatch_lines([
|
||||||
|
"*1 passed*"
|
||||||
|
])
|
||||||
|
|
|
@ -166,8 +166,8 @@ class Config(object):
|
||||||
raise self.Error("path %r is not relative to %r" %
|
raise self.Error("path %r is not relative to %r" %
|
||||||
(str(path), str(topdir)))
|
(str(path), str(topdir)))
|
||||||
# assumtion: pytest's fs-collector tree follows the filesystem tree
|
# assumtion: pytest's fs-collector tree follows the filesystem tree
|
||||||
names = filter(None, path.relto(topdir).split(path.sep))
|
names = list(filter(None, path.relto(topdir).split(path.sep)))
|
||||||
names.extend(parts)
|
names += parts
|
||||||
try:
|
try:
|
||||||
return self._rootcol.getbynames(names)
|
return self._rootcol.getbynames(names)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
|
|
|
@ -1,9 +1,3 @@
|
||||||
"""
|
|
||||||
|
|
||||||
EXPERIMENTAL dsession session (for dist/non-dist unification)
|
|
||||||
|
|
||||||
"""
|
|
||||||
|
|
||||||
import py
|
import py
|
||||||
from py.impl.test.session import Session
|
from py.impl.test.session import Session
|
||||||
from py.impl.test import outcome
|
from py.impl.test import outcome
|
||||||
|
|
|
@ -35,14 +35,15 @@ class GatewayManager:
|
||||||
gateways = []
|
gateways = []
|
||||||
for gateway in self.group:
|
for gateway in self.group:
|
||||||
spec = gateway.spec
|
spec = gateway.spec
|
||||||
if not spec._samefilesystem():
|
if spec.popen and not spec.chdir and not spec.python:
|
||||||
if spec not in seen:
|
continue
|
||||||
def finished():
|
if spec not in seen:
|
||||||
if notify:
|
def finished():
|
||||||
notify("rsyncrootready", spec, source)
|
if notify:
|
||||||
rsync.add_target_host(gateway, finished=finished)
|
notify("rsyncrootready", spec, source)
|
||||||
seen.add(spec)
|
rsync.add_target_host(gateway, finished=finished)
|
||||||
gateways.append(gateway)
|
seen.add(spec)
|
||||||
|
gateways.append(gateway)
|
||||||
if seen:
|
if seen:
|
||||||
self.hook.pytest_gwmanage_rsyncstart(
|
self.hook.pytest_gwmanage_rsyncstart(
|
||||||
source=source,
|
source=source,
|
||||||
|
|
|
@ -138,12 +138,8 @@ class PickleChannel(object):
|
||||||
self.RemoteError = channel.RemoteError
|
self.RemoteError = channel.RemoteError
|
||||||
|
|
||||||
def send(self, obj):
|
def send(self, obj):
|
||||||
from execnet.gateway_base import Channel
|
pickled_obj = self._ipickle.dumps(obj)
|
||||||
if not isinstance(obj, Channel):
|
self._channel.send(pickled_obj)
|
||||||
pickled_obj = self._ipickle.dumps(obj)
|
|
||||||
self._channel.send(pickled_obj)
|
|
||||||
else:
|
|
||||||
self._channel.send(obj)
|
|
||||||
|
|
||||||
def receive(self):
|
def receive(self):
|
||||||
pickled_obj = self._channel.receive()
|
pickled_obj = self._channel.receive()
|
||||||
|
|
|
@ -86,10 +86,12 @@ def install_slave(gateway, config):
|
||||||
sys.path.insert(0, os.getcwd())
|
sys.path.insert(0, os.getcwd())
|
||||||
from py.impl.test.dist.mypickle import PickleChannel
|
from py.impl.test.dist.mypickle import PickleChannel
|
||||||
from py.impl.test.dist.txnode import SlaveNode
|
from py.impl.test.dist.txnode import SlaveNode
|
||||||
|
channel.send("basicimport")
|
||||||
channel = PickleChannel(channel)
|
channel = PickleChannel(channel)
|
||||||
slavenode = SlaveNode(channel)
|
slavenode = SlaveNode(channel)
|
||||||
slavenode.run()
|
slavenode.run()
|
||||||
""")
|
""")
|
||||||
|
channel.receive()
|
||||||
channel = PickleChannel(channel)
|
channel = PickleChannel(channel)
|
||||||
basetemp = None
|
basetemp = None
|
||||||
if gateway.spec.popen:
|
if gateway.spec.popen:
|
||||||
|
|
|
@ -239,20 +239,6 @@ class TestPickleChannelFunctional:
|
||||||
error = channel._getremoteerror()
|
error = channel._getremoteerror()
|
||||||
assert isinstance(error, UnpickleError)
|
assert isinstance(error, UnpickleError)
|
||||||
|
|
||||||
def test_popen_with_newchannel(self):
|
|
||||||
channel = self.gw.remote_exec("""
|
|
||||||
from py.impl.test.dist.mypickle import PickleChannel
|
|
||||||
channel = PickleChannel(channel)
|
|
||||||
newchannel = channel.receive()
|
|
||||||
newchannel.send(42)
|
|
||||||
""")
|
|
||||||
channel = PickleChannel(channel)
|
|
||||||
newchannel = self.gw.newchannel()
|
|
||||||
channel.send(newchannel)
|
|
||||||
channel.waitclose()
|
|
||||||
res = newchannel.receive()
|
|
||||||
assert res == 42
|
|
||||||
|
|
||||||
def test_popen_with_various_methods(self):
|
def test_popen_with_various_methods(self):
|
||||||
channel = self.gw.remote_exec("""
|
channel = self.gw.remote_exec("""
|
||||||
from py.impl.test.dist.mypickle import PickleChannel
|
from py.impl.test.dist.mypickle import PickleChannel
|
||||||
|
|
Loading…
Reference in New Issue