pytest-dev / pytest-forked

extracted --boxed from pytest-xdist to ensure backward compat
MIT License
66 stars 21 forks source link

Integration with pytest-timeout plugin #21

Open jhagege opened 5 years ago

jhagege commented 5 years ago

Hi, when trying to add pytest-timeout to troubleshoot a hanging test, I get the following output:

Traceback (most recent call last):
  File "/opt/conda/lib/python3.6/site-packages/_pytest/main.py", line 203, in wrap_session
    session.exitstatus = doit(config, session) or 0
  File "/opt/conda/lib/python3.6/site-packages/_pytest/main.py", line 243, in _main
    config.hook.pytest_runtestloop(session=session)
  File "/opt/conda/lib/python3.6/site-packages/pluggy/hooks.py", line 289, in __call__
    return self._hookexec(self, self.get_hookimpls(), kwargs)
  File "/opt/conda/lib/python3.6/site-packages/pluggy/manager.py", line 87, in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
  File "/opt/conda/lib/python3.6/site-packages/pluggy/manager.py", line 81, in <lambda>
    firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
  File "/opt/conda/lib/python3.6/site-packages/pluggy/callers.py", line 203, in _multicall
    gen.send(outcome)
  File "/opt/conda/lib/python3.6/site-packages/pluggy/callers.py", line 80, in get_result
    raise ex[1].with_traceback(ex[2])
  File "/opt/conda/lib/python3.6/site-packages/pluggy/callers.py", line 187, in _multicall
    res = hook_impl.function(*args)
  File "/opt/conda/lib/python3.6/site-packages/_pytest/main.py", line 264, in pytest_runtestloop
    item.config.hook.pytest_runtest_protocol(item=item, nextitem=nextitem)
  File "/opt/conda/lib/python3.6/site-packages/pluggy/hooks.py", line 289, in __call__
    return self._hookexec(self, self.get_hookimpls(), kwargs)
  File "/opt/conda/lib/python3.6/site-packages/pluggy/manager.py", line 87, in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
  File "/opt/conda/lib/python3.6/site-packages/pluggy/manager.py", line 81, in <lambda>
    firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
  File "/opt/conda/lib/python3.6/site-packages/pluggy/callers.py", line 208, in _multicall
    return outcome.get_result()
  File "/opt/conda/lib/python3.6/site-packages/pluggy/callers.py", line 80, in get_result
    raise ex[1].with_traceback(ex[2])
  File "/opt/conda/lib/python3.6/site-packages/pluggy/callers.py", line 187, in _multicall
    res = hook_impl.function(*args)
  File "/opt/conda/lib/python3.6/site-packages/pytest_forked/__init__.py", line 35, in pytest_runtest_protocol
    reports = forked_run_report(item)
  File "/opt/conda/lib/python3.6/site-packages/pytest_forked/__init__.py", line 56, in forked_run_report
    result = ff.waitfinish()
  File "/opt/conda/lib/python3.6/site-packages/py/_process/forkedfunc.py", line 82, in waitfinish
    pid, systemstatus = waiter(self.pid, 0)
  File "/opt/conda/lib/python3.6/site-packages/pytest_timeout.py", line 140, in handler
    timeout_sigalrm(item, params.timeout)
  File "/opt/conda/lib/python3.6/site-packages/pytest_timeout.py", line 313, in timeout_sigalrm
    pytest.fail('Timeout >%ss' % timeout)
  File "/opt/conda/lib/python3.6/site-packages/_pytest/outcomes.py", line 113, in fail
    raise Failed(msg=msg, pytrace=pytrace)
Failed: Timeout >120.0s

Seems that the traceback includes only pytest-forked information.
Do you know if it's at all possible to get some traceback info from the wrapped test?
Thanks.

RonnyPfannschmidt commented 5 years ago

its not possible at the moment and i have no plans on implementing or investigating it personally as im no longer working on pytest-forked