Skip to content

Fix internal handling in process_from_remote #194

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 28, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions changelog/175.bugfix
Original file line number Diff line number Diff line change
@@ -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.
17 changes: 13 additions & 4 deletions testing/test_remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -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, ):
Expand Down Expand Up @@ -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')
Expand Down Expand Up @@ -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(('<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):
testdir.makepyfile('''
Expand Down
4 changes: 3 additions & 1 deletion xdist/slavemanage.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down