pytest-dev / pytest-dev/pytest-rerunfailures
reruns condition evaluates not in real time
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 477
- Forks
- 107
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 21
Description
- version: 10.0
- code
retryBool = True
@pytest.mark.flaky(condition=retryBool,reruns=2)
def test_demo():
retryBool = False
assert False
I found that if I set the mark like the above code, It can't stop retry when after the first run. It shows that the condition does not evaluate in real time but before the case was run.
But I think it's better if the condition evaluates in real time, because it let me able to control the retry on runtime. For example, if the number of failed cases reaches a certain number, then retry the following failed cases.
And the@pytest.mark.skipif(condition="bool",reason="xxx") evaluates in real time.
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 reproducing the supplied pytest example with pytest-rerunfailures 10.0 and compare its condition behavior with the skipif example. Determine the intended runtime evaluation semantics, then add coverage showing how a condition controls retries after a failure; done means the behavior is implemented and the regression is tested.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- testing
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100