diff --git a/changelog/175.bugfix b/changelog/175.bugfix new file mode 100644 index 00000000..35440813 --- /dev/null +++ b/changelog/175.bugfix @@ -0,0 +1,2 @@ +Fix error internal error handling during event loop in the master node. This bug would shadow the original errors +making extremely hard/impossible for users to diagnose the problem properly. diff --git a/testing/test_remote.py b/testing/test_remote.py index 151616ed..eeb5a4c9 100644 --- a/testing/test_remote.py +++ b/testing/test_remote.py @@ -29,9 +29,9 @@ def __str__(self): class SlaveSetup: use_callback = False - def __init__(self, request): - self.testdir = request.getfuncargvalue("testdir") + def __init__(self, request, testdir): self.request = request + self.testdir = testdir self.events = queue.Queue() def setup(self, ): @@ -65,8 +65,8 @@ def sendcommand(self, name, **kwargs): @pytest.fixture -def slave(request): - return SlaveSetup(request) +def slave(request, testdir): + return SlaveSetup(request, testdir) @pytest.mark.xfail(reason='#59') @@ -319,6 +319,15 @@ def test_func(): ("pytest_collectreport", "report.collector.fspath == bbb"), ]) + def test_process_from_remote_error_handling(self, slave, capsys): + slave.use_callback = True + slave.setup() + slave.slp.process_from_remote(('', ())) + out, err = capsys.readouterr() + assert 'INTERNALERROR> ValueError: unknown event: ' in out + ev = slave.popevent() + assert ev.name == "errordown" + def test_remote_env_vars(testdir): testdir.makepyfile(''' diff --git a/xdist/slavemanage.py b/xdist/slavemanage.py index 8091f8dd..36d52635 100644 --- a/xdist/slavemanage.py +++ b/xdist/slavemanage.py @@ -323,7 +323,9 @@ def process_from_remote(self, eventcall): # noqa too complex except: excinfo = py.code.ExceptionInfo() py.builtin.print_("!" * 20, excinfo) - self.config.pluginmanager.notify_exception(excinfo) + self.config.notify_exception(excinfo) + self.shutdown() + self.notify_inproc("errordown", node=self, error=excinfo) def unserialize_report(name, reportdict):