Skip to content
CodeKruPro

Run a pytest test many times

QuizMediumPython only

You suspect a test is flaky and want to run it 50 times. Which approach works?

  • Install the pytest-repeat plugin and run pytest --count=50 tests/test_cart.py::test_add
  • pytest --times=50 with plain pytest
  • @pytest.mark.parametrize("n", 50)
  • Copy the test 50 times

This question is part of Pro+

Pro+ opens every question in Interview Prep and the mock interview. Every article and the first 2 questions of each topic stay free. Hands-on Selenium and API tasks follow their course lesson's own lock.

See Pro+

Already have Pro+? Sign in