Skip to main content
CI Docs Codecov Python Versions Python Wheel Code Style: black PyPI - License

What is Pytest System Statistics

It’s a pytest plugin, extracted from pytest-salt-factories, which tracks the test suite CPU and memory usage and, optionally, includes a report section including that data, for example:

test_proc_sys_stats.py::test_one PASSED                                                [100%]
----------------------------------- Processes Statistics ------------------------------------
  .......... System - CPU: 17.80 %  MEM: 29.70 % (Virtual Memory)  SWAP:  12.80 %
  .. Test Suite Run - CPU:  0.00 %  MEM:  0.05 % (RSS)  MEM SUM: 0.09 % (RSS)  CHILD PROCS: 2
  ...... FooProcess - CPU:  0.00 %  MEM:  0.02 % (RSS)  MEM SUM: 0.03 % (RSS)  CHILD PROCS: 1

==================================== 1 passed in 0.34s ======================================

Install

Installing Pytest System Statistics is as simple as:

python -m pip install pytest-system-statistics

Usage

Controlling the behaviour of the plugin is made through flags which are passed to pytest.

--sys-stats             Print System CPU and MEM statistics after each test execution.
--no-sys-stats          Do not print System CPU and MEM statistics after each test execution.
--sys-stats-no-children Don't include child processes memory statistics.
--sys-stats-uss-mem     Use the USS("Unique Set Size", memory unique to a process which
                        would be freed if the process was terminated) memory instead which
                        is more expensive to calculate.

Tracking Additional Processes

To include additional processes to track and report statistics against, simply add it to the session scoped stats_processes fixture, for example:

@pytest.fixture
def my_server_process(stats_processes):
    proc = subprocess.Popen(...)
    stats_processes.add("MyServerProcess", proc.pid)
    try:
        yield proc
    finally:
        stats_processes.remove("MyServerProcess")

Contributing

The pytest-system-statistics project team welcomes contributions from the community. For more detailed information, refer to CONTRIBUTING.

Documentation

The full documentation can be seen here.

Metadata

Release files for pytest-system-statistics 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pytest-system-statistics 1.0.2
File Size Uploaded Provenance
pytest-system-statistics-1.0.2.tar.gz 56.9 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for pytest-system-statistics 1.0.2
File Interpreter ABI Platform
pytest_system_statistics-1.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 68.8 kB

Release files / pytest-system-statistics-1.0.2.tar.gz

Download URL pytest-system-statistics-1.0.2.tar.gz
Size 56.9 kB
Tags Source
SHA-256 checksum
How to use checksums
059b739e3f4e288cd1e4dbe5785e077ee89df26f64e6c5164e9bb5d6657a4a71
BLAKE2b-256 checksum
How to use checksums
f31b1fb514da7c049915e1d8dd843fee663a400b8db9c8a39d5fe7ca5a6e99c7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10

Release files / pytest_system_statistics-1.0.2-py3-none-any.whl

Download URL pytest_system_statistics-1.0.2-py3-none-any.whl
Size 11.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
54abc7335d60a89ef0658ee233790d9ae65aed518233df50b0530244369b06ec
BLAKE2b-256 checksum
How to use checksums
d8764ab17888a165f5493aae50ebfb5a99eeb4a5592cddf55c67ed6f4d072bae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10

Security for pytest-system-statistics 1.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page