fixes for new internal pytest tmpdir handling

This commit is contained in:
holger krekel
2010-11-22 11:41:23 +01:00
parent c924dda30f
commit 3fc03c8c8e
5 changed files with 24 additions and 26 deletions

View File

@@ -1,4 +1,4 @@
import py
import pytest, py
import sys
from xdist.slavemanage import NodeManager
queue = py.builtin._tryimport('queue', 'Queue')
@@ -171,8 +171,8 @@ class DSession:
if self.terminal and self.config.option.verbose >= 0:
self.terminal.write_line(line)
def pytest_sessionstart(self, session, __multicall__):
#print "remaining multicall methods", __multicall__.methods
@pytest.mark.trylast
def pytest_sessionstart(self, session):
if self.config.option.verbose > 0:
self.report_line("instantiating gateways (use -v for details): %s" %
",".join(self.config.option.tx))
@@ -181,11 +181,13 @@ class DSession:
def pytest_sessionfinish(self, session):
""" teardown any resources after a test run. """
self.nodemanager.teardown_nodes()
nm = getattr(self, 'nodemanager', None) # if not fully initialized
if nm is not None:
nm.teardown_nodes()
def pytest_collection(self, __multicall__):
def pytest_collection(self):
# prohibit collection of test items in master process
__multicall__.methods[:] = []
return True
def pytest_runtestloop(self):
numnodes = len(self.nodemanager.gwmanager.specs)
@@ -326,7 +328,7 @@ class TerminalDistReporter:
gateway.id, rinfo.platform, version, rinfo.cwd))
def pytest_testnodeready(self, node):
if self.config.option.verbose >= 0:
if self.config.option.verbose > 0:
d = node.slaveinfo
infoline = "[%s] Python %s" %(
d['id'],

View File

@@ -14,9 +14,7 @@ class NodeManager(object):
self.specs = self.gwmanager.specs
self.roots = self._getrsyncdirs()
self._nodesready = py.std.threading.Event()
def trace(self, msg):
self.config.hook.pytest_trace(category="nodemanage", msg=msg)
self.trace = self.config.trace.get("nodemanager")
def config_getignores(self):
return self.config.getini("rsyncignore")
@@ -89,9 +87,9 @@ class NodeManager(object):
config = self.config
candidates = [py._pydir,pytestpath,pytestdir]
candidates += config.option.rsyncdir
conftestroots = config.getini("rsyncdirs")
if conftestroots:
candidates.extend(conftestroots)
rsyncroots = config.getini("rsyncdirs")
if rsyncroots:
candidates.extend(rsyncroots)
roots = []
for root in candidates:
root = py.path.local(root).realpath()
@@ -101,7 +99,6 @@ class NodeManager(object):
roots.append(root)
return roots
class GatewayManager:
"""
instantiating, managing and rsyncing to test hosts
@@ -239,7 +236,8 @@ class SlaveController(object):
option_dict = vars(self.config.option)
if spec.popen:
name = "popen-%s" % self.gateway.id
option_dict['basetemp'] = str(self.config.getbasetemp().join(name))
basetemp = self.config._tmpdirhandler.getbasetemp()
option_dict['basetemp'] = str(basetemp.join(name))
self.config.hook.pytest_configure_node(node=self)
self.channel = self.gateway.remote_exec(xdist.remote)
self.channel.send((self.slaveinput, args, option_dict))