diff --git a/py/test/dist/testing/test_dsession.py b/py/test/dist/testing/test_dsession.py index 1233d1a90..bf351c783 100644 --- a/py/test/dist/testing/test_dsession.py +++ b/py/test/dist/testing/test_dsession.py @@ -7,9 +7,10 @@ import py XSpec = py.execnet.XSpec def run(item, node): - report = item.config.pytestplugins.do_itemrun(item) - report.node = node - return report + from py.__.test.runner import basic_run_report + rep = basic_run_report(item) + rep.node = node + return rep class MockNode: def __init__(self): @@ -218,7 +219,7 @@ class TestDSession: session.loop_once(loopstate) assert node.sent == [[item]] - ev = run(item, node) + ev = run(item, node) session.queueevent("itemtestreport", ev) session.loop_once(loopstate) assert loopstate.shuttingdown diff --git a/py/test/dist/testing/test_txnode.py b/py/test/dist/testing/test_txnode.py index fe1b84c7e..d40349d5a 100644 --- a/py/test/dist/testing/test_txnode.py +++ b/py/test/dist/testing/test_txnode.py @@ -28,6 +28,8 @@ class EventQueue: if name == eventname: return args events.append(name) + if name == "internalerror": + print str(kwargs["excrepr"]) class MySetup: def __init__(self, pyfuncitem): diff --git a/py/test/dist/txnode.py b/py/test/dist/txnode.py index f536bf27d..44a03f85a 100644 --- a/py/test/dist/txnode.py +++ b/py/test/dist/txnode.py @@ -106,12 +106,16 @@ class SlaveNode(object): def sendevent(self, eventname, *args, **kwargs): self.channel.send((eventname, args, kwargs)) + def pyevent__itemtestreport(self, report): + self.sendevent("itemtestreport", report) + def run(self): channel = self.channel self.config, basetemp = channel.receive() if basetemp: self.config.basetemp = py.path.local(basetemp) self.config.pytestplugins.do_configure(self.config) + self.config.pytestplugins.register(self) self.sendevent("slaveready") try: while 1: @@ -121,16 +125,12 @@ class SlaveNode(object): break if isinstance(task, list): for item in task: - self.runtest(item) + item.config.pytestplugins.do_itemrun(item) else: - self.runtest(task) + task.config.pytestplugins.do_itemrun(item=task) except KeyboardInterrupt: raise except: er = py.code.ExceptionInfo().getrepr(funcargs=True, showlocals=True) self.sendevent("internalerror", excrepr=er) raise - - def runtest(self, item): - report = item.config.pytestplugins.do_itemrun(item) - self.sendevent("itemtestreport", report) diff --git a/py/test/plugin/pytest_default.py b/py/test/plugin/pytest_default.py index cf4acea13..7c9c7c70e 100644 --- a/py/test/plugin/pytest_default.py +++ b/py/test/plugin/pytest_default.py @@ -10,7 +10,8 @@ class DefaultPlugin: else: runner = basic_run_report report = runner(item, pdb=pdb) - return report + item.config.pytestplugins.notify("itemtestreport", report) + return True def pytest_pyfunc_call(self, pyfuncitem, args, kwargs): pyfuncitem.obj(*args, **kwargs) diff --git a/py/test/pytestplugin.py b/py/test/pytestplugin.py index bf387a425..2da1a3744 100644 --- a/py/test/pytestplugin.py +++ b/py/test/pytestplugin.py @@ -106,7 +106,9 @@ class PytestPlugins(object): config.bus.unregister(self) def do_itemrun(self, item, pdb=None): - return self.pyplugins.call_firstresult("pytest_itemrun", item=item, pdb=pdb) + res = self.pyplugins.call_firstresult("pytest_itemrun", item=item, pdb=pdb) + if res is None: + raise ValueError("could not run %r" %(item,)) # # XXX old code to automatically load classes diff --git a/py/test/session.py b/py/test/session.py index 168bc38e0..bbf65c4f0 100644 --- a/py/test/session.py +++ b/py/test/session.py @@ -105,7 +105,6 @@ class Session(object): colitems = self.getinitialitems(colitems) self.shouldstop = False self.sessionstarts() - #self.bus.notify("testnodeready", maketestnodeready()) exitstatus = outcome.EXIT_OK captured_excinfo = None try: @@ -134,5 +133,4 @@ class Session(object): def runtest(self, item): pdb = self.config.option.usepdb and self.runpdb or None - report = item.config.pytestplugins.do_itemrun(item, pdb=pdb) - self.bus.notify("itemtestreport", report) + item.config.pytestplugins.do_itemrun(item, pdb=pdb)