Skip to main content

A pytest plugin to list worker statistics after a xdist run.

Project description

pytest-xdist-worker-stats

A pytest plugin to list worker statistics after a xdist run.

Installation

$ pip install pytest-xdist-worker-stats

Usage

All that is needed is to have xdist installed & enabled, and to run tests in multiple workers.

Default mode

pytest {all_your_options}
============================= test session starts ==============================
platform linux -- Python 3.10.7, pytest-8.1.1, pluggy-1.4.0
plugins: xdist-worker-stats-0.2.0, xdist-3.5.0
created: 2/2 workers
2 workers [4 items]

....                                                                     [100%]
============================== Worker statistics ===============================
worker gw0  :    2 tests       0.00s runtime
worker gw1  :    2 tests       0.00s runtime

Tests   : min        2, max        2, average 2.0
Runtime : min    0.00s, max    0.00s, average 0.00s
============================== 4 passed in 1.82s ===============================

Summary mode

pytest {all_your_options} --no-xdist-runtimes
============================= test session starts ==============================
platform linux -- Python 3.10.7, pytest-8.1.1, pluggy-1.4.0
plugins: xdist-worker-stats-0.2.0, xdist-3.5.0
created: 2/2 workers
2 workers [4 items]

....                                                                     [100%]
============================== Worker statistics ===============================
Tests   : min        2, max        2, average 2.0
Runtime : min    0.00s, max    0.00s, average 0.00s
============================== 4 passed in 1.82s ===============================

Breakdown mode

pytest {all_your_options} --xdist-breakdown
============================= test session starts ==============================
platform linux -- Python 3.10.7, pytest-8.1.1, pluggy-1.4.0
plugins: xdist-worker-stats-0.2.0, xdist-3.5.0
created: 2/2 workers
2 workers [4 items]

....                                                                     [100%]
============================== Worker statistics ===============================
worker gw0  :    2 tests       0.00s runtime
    test_plugin.py::test_bar[1]
    test_plugin.py::test_foo
worker gw1  :    2 tests       0.00s runtime
    test_plugin.py::test_bar[2]
    test_plugin.py::test_bar[3]

Tests   : min        2, max        2, average 2.0
Runtime : min    0.00s, max    0.00s, average 0.00s
============================== 4 passed in 1.82s ===============================

Development

Poetry (dependencies) and pre-commit (coding standards) are required for development.

$ poetry install
$ pre-commit install

Thanks

Many thanks to Denys Korytkin for the article How to get data from pytest-xdist nodes.

Changelog

0.1.4 (Aug 8, 2023)

  • Summarize statistics

0.1.3 (Aug 8, 2023)

  • Add CI

0.1.2 (Jun 19, 2023)

  • Fix several issues

0.1.1 (Jun 15, 2023)

  • First Release

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pytest_xdist_worker_stats-0.2.0.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file pytest_xdist_worker_stats-0.2.0.tar.gz.

File metadata

File hashes

Hashes for pytest_xdist_worker_stats-0.2.0.tar.gz
Algorithm Hash digest
SHA256 4da1811fbbe049fc8c032412dc9771c7c6ba44dda922ee48f0350556b1557f73
MD5 345be4dea921766d057403cb9a39d862
BLAKE2b-256 ade497d497d1e0a031d6688bff6d49ab5afa464bf835f0c7c0c0ba037bbe6b14

See more details on using hashes here.

Provenance

File details

Details for the file pytest_xdist_worker_stats-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pytest_xdist_worker_stats-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8a6f9946be32000372f2117225fec34a34ce8d8ff4aa026f68d03f0880800909
MD5 a9cbeb1f79103c61c63084fcd72dd5f1
BLAKE2b-256 d64e7214268ac2e50728129126d7ea99cbd750f25f288d4ab2e31e38582bc674

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page