pytest-dev / pytest-dev/pytest-rerunfailures

reruns condition evaluates not in real time

Open
#161 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.