Closed
Description
Sometimes when running tests with semi-random data (e.g. from factory_boy), you know the test will fail if the generated data matches some condition. Rather than execute the test when you know it will fail, it would be nice if you could tell pytest to re-run that test, probably configurable up to N times. For example:
def test_something_with_different_people():
person1, person2 = PersonFactory.build_batch(2)
# if this is False, rerun the test up to N times
pytest.assume(person1.name != person2.name)
# some test that depends on the condition being true
This is inspired by assume()
from hypothesis.
Metadata
Metadata
Assignees
Labels
No labels