pytest-dev / pytest-dev/pytest-forked
Integration with pytest-timeout plugin
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 83
- Forks
- 29
- PR merge metrics
- No merged PRs in 30d
Description
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.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing pytest_forked/init.py, especially pytest_runtest_protocol and forked_run_report, through py/_process/forkedfunc.py and the timeout path in pytest_timeout.py. Determine whether the wrapped test traceback can be preserved, and consider the work done when a timeout reports useful information from the wrapped test rather than only pytest-forked frames.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- testing
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100