pytest plugin
Run a test suite on your phone - see passes/fails tick live.
The pytest plugin ships as an entry-point in the main `chirp-sdk` package - installing the SDK is the only step. Plugin is opt-in per-run (you have to pass `--chirp` or set `CHIRP_PYTEST=1`) so it imposes zero overhead on developers who don't want it.
When enabled, pytest opens a @pytest activity at `pytest_sessionstart`, ticks it on every test result (pass green / fail red / skip yellow), and closes on `pytest_sessionfinish` with the final summary. Useful for long suites you want to monitor from your phone - kick off `pytest -k integration` on your laptop, walk away, get notified when it finishes.
Prerequisites
- Python 3.9+ with pytest 7+.
- A Chirp account.
Setup
- 1
Install the SDK
The pytest plugin auto-registers via entry-point - no separate install.
shellpip install chirp-sdk - 2
Pair your laptop
chirp loginwrites credentials. The plugin reads them on session start.shellchirp login - 3
Run pytest with --chirp
Single flag opts the run in. Without the flag, pytest behaves identically to a Chirp-less install.
shellpytest --chirp - 4
(Optional) Always-on via environment variable
If you want every pytest run to send Chirp pings, set
CHIRP_PYTEST=1in your shell profile. Override per-run with--no-chirpto disable.shell# In ~/.zshrc or ~/.bashrc: export CHIRP_PYTEST=1 # Disable for one run: pytest --no-chirp - 5
(Optional) Customize the activity name + schema
Pass via env vars or pytest config:
shell# pyproject.toml: [tool.chirp.pytest] name = "integration suite" schema = "@pytest" # default key = "ci-${CIRCLE_BUILD_NUM}" # coalesce reruns of the same CI build
What you’ll see
Card header: pytest snake logo + "pytest · RUNNING" + suite name (or repo basename). Live progress bar based on collected count. Action line shows the currently-running test. The activity timeline appends a green checkmark per pass, red X per fail, yellow dash per skip. On session finish, closes green if all pass, red if any fail (with the count of failures), yellow if all are skipped.
Troubleshooting
- Plugin doesn't activate even with --chirp.
- Check the plugin is registered:
pytest --trace-config 2>&1 | grep chirpshould showplugin: chirp_pytest. If it's missing, the SDK isn't installed in the same env as pytest. Common cause: pytest from a global pip, chirp-sdk in a venv.pip install chirp-sdkin the same env that has pytest. - Card never closes after pytest finishes.
- If pytest is killed mid-run (Ctrl-C, OOM, segfault), the
pytest_sessionfinishhook doesn't fire and the activity hangs. Auto-expires after 4h. To avoid: run pytest undertimeout 1h pytest --chirpand the SDK's signal handler closes the card on SIGTERM. - Too noisy when running quick local tests.
- Don't set CHIRP_PYTEST=1 globally. Pass
--chirpexplicitly only on long-running suites. Or filter by suite name via the pyproject config - only enable forname = "integration"etc.