Run pytest tests in parallel with pytest-xdist
You can significantly speed up your pytest suite by running tests in parallel.
Install
pip install pytest-xdist
Run tests in parallel
Use -n num_workers where num_workers is the number of parallel workers.
pytest -n 4
Or let pytest-xdist choose an appropriate number of workers automatically.
pytest -n auto
-n auto uses as many workers as there are available CPU cores.