pytest-resource-mon
A pytest plugin that snapshots system resources (CPU, memory, disk) for every test and ships the metrics to Tinybird or a local file.
Key Features
- Per-test resource snapshots — captures CPU, memory, and disk usage before and after each test.
- Batched delivery — groups test records into configurable batches to reduce network overhead.
- CI context — automatically captures GitHub Actions environment variables so metrics can be correlated with runs, commits, and workflows.
- Flexible output — send metrics to Tinybird over HTTP or write NDJSON to a local file.
How It Works
The plugin emits three event types:
session_start— records total CPU count, memory, and disk at the beginning of the test session.test— records before/after snapshots of CPU %, available memory, and free disk for each test, plus duration.session_end— records final resource state and the pytest exit status.
Next Steps
See Getting Started to install and run the plugin.