Skip to content

Commit

Permalink
some changes to make remote testing work better - slightly hackish an…
Browse files Browse the repository at this point in the history
…d will remain so until 'tox' is used to create environments and properly set things up.
  • Loading branch information
hpk42 committed Nov 13, 2010
1 parent a0652e9 commit d81ffaa
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 16 deletions.
7 changes: 7 additions & 0 deletions ISSUES.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
next release critical
-----------------------------------------------
tag: bug

miserably fails: --dist=each --tx popen --tx socket=...


rename / hooks
-----------------------------------------------
tag: bug
Expand Down
9 changes: 5 additions & 4 deletions testing/test_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,10 @@ def test_xspecs_multiplied(self, testdir):
def test_getrsyncdirs(self, testdir):
config = testdir.parseconfigure('--rsyncdir=' + str(testdir.tmpdir))
nm = NodeManager(config, specs=[execnet.XSpec("popen")])
roots = nm._getrsyncdirs()
assert len(roots) == 1 + 1 # pylib
assert testdir.tmpdir in roots
assert not nm._getrsyncdirs()
nm = NodeManager(config, specs=[execnet.XSpec("popen//chdir=qwe")])
assert nm.roots
assert testdir.tmpdir in nm.roots

def test_getrsyncdirs_with_conftest(self, testdir):
p = py.path.local()
Expand All @@ -55,7 +56,7 @@ def test_getrsyncdirs_with_conftest(self, testdir):
""")
config = testdir.parseconfigure(
testdir.tmpdir, '--rsyncdir=y', '--rsyncdir=z')
nm = NodeManager(config, specs=[execnet.XSpec("popen")])
nm = NodeManager(config, specs=[execnet.XSpec("popen//chdir=xyz")])
roots = nm._getrsyncdirs()
#assert len(roots) == 3 + 1 # pylib
assert py.path.local('y') in roots
Expand Down
2 changes: 2 additions & 0 deletions testing/test_remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ def test_xfail_imperative():
assert newrep.passed == rep.passed
assert newrep.failed == rep.failed
assert newrep.skipped == rep.skipped
if newrep.skipped:
assert len(newrep.reprcrash) == 3
assert newrep.outcome == rep.outcome
assert newrep.when == rep.when
assert newrep.keywords == rep.keywords
Expand Down
12 changes: 8 additions & 4 deletions xdist/dsession.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,10 +247,14 @@ def slave_slavefinished(self, node):

def slave_errordown(self, node, error):
self.config.hook.pytest_testnodedown(node=node, error=error)
crashitem = self.sched.remove_node(node)
if crashitem:
self.handle_crashitem(crashitem, node)
#self.report_line("item crashed on node: %s" % crashitem)
try:
crashitem = self.sched.remove_node(node)
except KeyError:
pass
else:
if crashitem:
self.handle_crashitem(crashitem, node)
#self.report_line("item crashed on node: %s" % crashitem)
if not self.sched.hasnodes():
self.session_finished = True

Expand Down
5 changes: 5 additions & 0 deletions xdist/remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,11 @@ def remote_initconfig(option_dict, args):

if __name__ == '__channelexec__':
slaveinput,args,option_dict = channel.receive()
importpath = os.getcwd()
sys.path.insert(0, importpath) # XXX only for remote situations
os.environ['PYTHONPATH'] = (importpath + os.pathsep +
os.environ.get('PYTHONPATH', ''))
#os.environ['PYTHONPATH'] = importpath
import py
config = remote_initconfig(option_dict, args)
config.slaveinput = slaveinput
Expand Down
19 changes: 11 additions & 8 deletions xdist/slavemanage.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ def __init__(self, config, specs=None):
self.config = config
if specs is None:
specs = self._getxspecs()
self.roots = self._getrsyncdirs()
self.gwmanager = GatewayManager(specs, config.hook)
self.specs = self.gwmanager.specs
self.roots = self._getrsyncdirs()
self._nodesready = py.std.threading.Event()

def trace(self, msg):
Expand All @@ -34,12 +35,6 @@ def rsync_roots(self):
# send each rsync root
for root in self.roots:
self.gwmanager.rsync(root, **options)
else:
XXX # do we want to care for situations without explicit rsyncdirs?
# we transfer our topdir as the root
self.gwmanager.rsync(self.config.topdir, **options)
# and cd into it
self.gwmanager.multi_chdir(self.config.topdir.basename, inplacelocal=False)

def makegateways(self):
# we change to the topdir sot that
Expand Down Expand Up @@ -83,8 +78,16 @@ def _getxspecs(self):
return [execnet.XSpec(x) for x in xspeclist]

def _getrsyncdirs(self):
for spec in self.specs:
if not spec.popen or spec.chdir:
break
else:
return []
import pytest, _pytest
pytestpath = pytest.__file__.rstrip("co")
pytestdir = py.path.local(_pytest.__file__).dirpath()
config = self.config
candidates = [py._pydir]
candidates = [py._pydir,pytestpath,pytestdir]
candidates += config.option.rsyncdir
conftestroots = config.getini("rsyncdirs")
if conftestroots:
Expand Down

0 comments on commit d81ffaa

Please sign in to comment.