pytest-dev / pytest-dev/pytest-rerunfailures
Incompatible with pytest-timeout plugin
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 477
- Forks
- 107
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 21
Description
pytest-rerunfailures is not compatible with the pytest-timeout plugin.
Probably b/c the same pytest hooks are used. The first time, the timeout is observed, but when the test case re-runs, there's no timeout.
pytest-timeoutis more widely used and likely would be easier for the fix to be in this plugin if possible..
Here's a test that fails:
import pytest
pytest_plugins = 'pytester'
def test_pytest_timeout_compatibility_fails(testdir):
"""
Verifies the `pytest-rerunfailures` plugin is compatible with `pytest-timeout`
plugin when the test case is not done in the allotted time.
"""
testdir.makepyfile(
"""
import time
import pytest
@pytest.mark.flaky
@pytest.mark.timeout(timeout=1)
def test_times_out():
time.sleep(2)
assert True
"""
)
result = testdir.runpytest()
outcome = result.parseoutcomes()
assert outcome.get('rerun') == 1
assert outcome.get('failed') == 1
When the test case re-runs, it ignores the timeout and passes.
Note: doesn't matter which decorator comes first (flaky or timeout), the behavior is the same.
Contributor guide
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 running the supplied pytester reproduction with pytest-rerunfailures and pytest-timeout, then inspect the plugin's pytest hook handling involved in reruns. Done means the timeout is enforced again on the rerun and the reproduction reports one rerun and one failed test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- testing-qa
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100