I am having an issue with pytest-json-report
and pytest-xdist
plugins working togehter. Basically, the tests run smoothly when started with these two separatley, so from functional point of view, seems like there is no issue.
The problem starts only when both are enabled. I am getting this after the nodes are being initialized (running with -n 2
):
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR> File "/path/to/test/root/.venv/lib/python3.7/site-packages/_pytest/main.py", line 196, in wrap_session
INTERNALERROR> session.exitstatus = doit(config, session) or 0
INTERNALERROR> File "/path/to/test/root/.venv/lib/python3.7/site-packages/_pytest/main.py", line 246, in _main
INTERNALERROR> config.hook.pytest_runtestloop(session=session)
INTERNALERROR> File "/path/to/test/root/.venv/lib/python3.7/site-packages/pluggy/hooks.py", line 286, in __call__
INTERNALERROR> return self._hookexec(self, self.get_hookimpls(), kwargs)
INTERNALERROR> File "/path/to/test/root/.venv/lib/python3.7/site-packages/pluggy/manager.py", line 93, in _hookexec
INTERNALERROR> return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR> File "/path/to/test/root/.venv/lib/python3.7/site-packages/pluggy/manager.py", line 87, in <lambda>
INTERNALERROR> firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
INTERNALERROR> File "/path/to/test/root/.venv/lib/python3.7/site-packages/pluggy/callers.py", line 208, in _multicall
INTERNALERROR> return outcome.get_result()
INTERNALERROR> File "/path/to/test/root/.venv/lib/python3.7/site-packages/pluggy/callers.py", line 80, in get_result
INTERNALERROR> raise ex[1].with_traceback(ex[2])
INTERNALERROR> File "/path/to/test/root/.venv/lib/python3.7/site-packages/pluggy/callers.py", line 187, in _multicall
INTERNALERROR> res = hook_impl.function(*args)
INTERNALERROR> File "/path/to/test/root/.venv/lib/python3.7/site-packages/xdist/dsession.py", line 112, in pytest_runtestloop
INTERNALERROR> self.loop_once()
INTERNALERROR> File "/path/to/test/root/.venv/lib/python3.7/site-packages/xdist/dsession.py", line 135, in loop_once
INTERNALERROR> call(**kwargs)
INTERNALERROR> File "/path/to/test/root/.venv/lib/python3.7/site-packages/xdist/dsession.py", line 177, in worker_workerfinished
INTERNALERROR> assert not crashitem, (crashitem, node)
INTERNALERROR> AssertionError: ('path_to_test/test_file.py::test_function[TestName]', <WorkerController gw1>)
INTERNALERROR> assert not 'path_to_test/test_file.py::test_function[TestName]'
It's difficult to find the troublemaker, since the stack trace is not complete.
I tried several things to get rid of it:
- Bumping xdist version (up and down)
- Same thing with json-report version
- Bumping pytest itself - also up and down
- Clearing out all custom hooks I overwritten (so basically plugins work as their defaults)
- Invoking json-report by cmd line switches or by putting it in
pytest_configure
- Running on python 3.8.x
- Running on different OS.
My questions are:
- Did anybody have similar problems?
- How to debug it to get the clear root cause of the problem
And of course I would be grateful for other suggestions and ideas how to tackle this.