Merge pull request #194 from nicoddemus/error-handler

Fix internal handling in process_from_remote
This commit is contained in:
Ronny Pfannschmidt
2017-07-28 07:33:56 +02:00
committed by GitHub
3 changed files with 18 additions and 5 deletions

2
changelog/175.bugfix Normal file
View File

@@ -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.

View File

@@ -29,9 +29,9 @@ class EventCall:
class SlaveSetup: class SlaveSetup:
use_callback = False use_callback = False
def __init__(self, request): def __init__(self, request, testdir):
self.testdir = request.getfuncargvalue("testdir")
self.request = request self.request = request
self.testdir = testdir
self.events = queue.Queue() self.events = queue.Queue()
def setup(self, ): def setup(self, ):
@@ -65,8 +65,8 @@ class SlaveSetup:
@pytest.fixture @pytest.fixture
def slave(request): def slave(request, testdir):
return SlaveSetup(request) return SlaveSetup(request, testdir)
@pytest.mark.xfail(reason='#59') @pytest.mark.xfail(reason='#59')
@@ -319,6 +319,15 @@ class TestSlaveInteractor:
("pytest_collectreport", "report.collector.fspath == bbb"), ("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(('<nonono>', ()))
out, err = capsys.readouterr()
assert 'INTERNALERROR> ValueError: unknown event: <nonono>' in out
ev = slave.popevent()
assert ev.name == "errordown"
def test_remote_env_vars(testdir): def test_remote_env_vars(testdir):
testdir.makepyfile(''' testdir.makepyfile('''

View File

@@ -323,7 +323,9 @@ class SlaveController(object):
except: except:
excinfo = py.code.ExceptionInfo() excinfo = py.code.ExceptionInfo()
py.builtin.print_("!" * 20, excinfo) 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): def unserialize_report(name, reportdict):