Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Getting Started

Installation

pip install pytest-resource-mon

Or with uv:

uv add pytest-resource-mon

The plugin requires Python 3.9+ and depends on pytest>=7.0 and psutil>=5.9.

Quick Start

Write metrics to a local file

pytest --tinybird-file metrics.ndjson

This writes one NDJSON line per event to metrics.ndjson.

Send metrics to Tinybird

export TINYBIRD_WRITE_TOKEN=your-token
pytest

The plugin activates automatically when TINYBIRD_WRITE_TOKEN is set.

Disable the plugin

pytest --tinybird-disable

This flag prevents the plugin from registering, even if a token or file path is configured.

Activation Rules

The plugin activates when either of these conditions is true:

  1. The TINYBIRD_WRITE_TOKEN environment variable is set (Tinybird HTTP mode).
  2. The --tinybird-file flag is provided (local file mode).

If TINYBIRD_WRITE_TOKEN is set, it takes priority over --tinybird-file. If neither is configured, the plugin does nothing.

Passing --tinybird-disable always prevents activation regardless of other settings.