Plugins That Change the Normal Test Run Flow
The following plugins in some way change how pytest runs your tests.
pytest-repeat: Run Tests More Than Once
To run tests more than once per session, use the pytest-repeat plugin.[35] This plugin is useful if you have an intermittent failure in a test.
Following is a normal test run of tests that start with test_list from ch7/tasks _proj_v2:
| $ cd /path/to/code/ch7/tasks_proj_v2 |
| $ pip install . |
| $ pip install pytest-repeat |
| $ pytest -v -k test_list |
| ===================== test session starts ====================== |
| plugins: repeat-0.4.1, mock-1.6.2 |
| collected 62 items |
| |
| tests/func/test_api_exceptions.py::test_list_raises PASSED |
| tests/unit/test_cli.py::test_list_no_args ... |
Get Python Testing with pytest now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.