Skip to content

Parallel tests and retries

Use the passing example from the tutorial.

Install the optional plugins separately:

python -m pip install pytest-xdist==3.8.0 pytest-rerunfailures==16.7
python -m pytest -q test_example.py -n 2 --xray-case-report=cases.json
python -m pytest -q test_example.py --reruns=1 --xray-case-report=cases.json

-n 2 uses two worker processes. --reruns=1 allows one retry after a failure. Our restored passing example has nothing to retry. With a failing-then-passing test, pytest may exit 0 while this reporter still records an earlier failure; see the status table below. The main process writes one report. Results can arrive in a different order. With --dist=each, the same node observed on two workers is retained as two worker attempts.