Pytest Xdist Worker Stats

0.4.0 · active · verified Fri Apr 17

pytest-xdist-worker-stats is a pytest plugin that provides detailed statistics about individual worker performance after a pytest-xdist run, including test counts and execution times. The current version is 0.4.0, and it maintains an active, moderate release cadence.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to use `pytest-xdist-worker-stats` by creating a simple test file with parameterized tests that will be run in parallel by `pytest-xdist`. The `--xdist-worker-stats` flag will activate the plugin and display the worker statistics after the test run.

import time
import pytest

@pytest.mark.parametrize("i", range(5))
def test_slow_task_a(i):
    time.sleep(0.1)

@pytest.mark.parametrize("i", range(3))
def test_slow_task_b(i):
    time.sleep(0.2)

# To run: save this as test_example.py, then run from your terminal:
# pip install pytest pytest-xdist pytest-xdist-worker-stats
# pytest -n 2 --xdist-worker-stats test_example.py

view raw JSON →