{"library":"pytest-flakefinder","title":"pytest-flakefinder","description":"pytest-flakefinder is a plugin for the pytest testing framework that helps identify flaky tests by running them multiple times within a single pytest invocation. The current version, 1.1.0, was last released in October 2022 and is maintained by Dropbox, offering features to configure the number of runs and set a maximum execution time.","language":"python","status":"active","last_verified":"Sat Apr 11","install":{"commands":["pip install pytest-flakefinder"],"cli":{"name":"pytest","version":"pytest 9.0.3"}},"imports":[],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import random\n\ndef test_might_be_flaky():\n    # This test has a 30% chance of failing to simulate flakiness\n    if random.random() < 0.3:\n        assert False, \"This test failed flakily!\"\n    else:\n        assert True\n\n# To run all tests 100 times to find flakes:\n# pytest --flake-finder --flake-runs=100\n\n# To run tests with a maximum time limit of 5 minutes:\n# pytest --flake-finder --flake-max-minutes=5\n\n# Combine with pytest-xdist for parallel execution (requires prior installation of pytest-xdist):\n# pytest -n auto --flake-finder --flake-runs=100","lang":"python","description":"After installation, pytest-flakefinder integrates directly with the `pytest` command-line interface. You enable it with `--flake-finder` and can customize the number of repetitions with `--flake-runs` or set a time limit with `--flake-max-minutes`. Place the example code in a file named `test_example.py` and run the `pytest` commands from your terminal.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}