pytest-chronicle
Searchable git-aware pytest history with a lean CLI and easy storage backends.
Pin down regressions. Squash bugs. Join the Federation today.
What it does
Running pytest:
- Emits per-test records (result/stdout/stderr/traceback)
- Persists test result records to SQLite / Postgres (or implement your own storage backend) with:
- git/CI metadata
- pytest invocation parameters
- timestamps
- user-defined labels
With the pytest-chronicle CLI you can now query the test result history.
Install
pip install pytest-chronicle
Quickstart
pytest-chronicle init # create config + local sqlite
pytest -q # auto-ingests using config/env/fallback SQLite
pytest-chronicle query last-green --format json --pretty # ask questions
pytest-chronicle query last-red tests/test_mod.py::Test::test_case # pytest-style selectors
Common commands
pytest-chronicle init– scaffold.pytest-chronicle.tomland an async SQLite DB.pytest-chronicle ingest --jsonl <path>– ingest JSONL/summary artifacts.pytest-chronicle query last-red|last-green|errors|flipped-green|compare– history lookups. Filters:-k/-mlike pytest,--labels,--since,--until,--branch/--commit, positional pytest-style selectors, or--pytest-select "-m 'slow' -k expr path::nodeid". Outputs include per-test runtime with smart units (μs/ms/s) and git metadata; text mode shows colored tables by default (--no-colorto disable). Slow tests (≥1s) are highlighted yellow, very slow (≥5s) in red. Use--show-marksto display test marks.pytest-chronicle query timeline– colored TTY timeline of recent runs for matching tests (?marks not-run/filtered cases). Use-t/--show-timesto display execution times.pytest-chronicle query slowest– tests sorted by execution time (slowest first); use--status failedto find slowest failures.pytest-chronicle query stats– per-test failure rates, pass/fail counts, and timing stats; use--min-runs Nto filter low-sample tests,--sort-by failure-rate|avg-time|max-time|total-runsto rank.pytest-chronicle run <project> -- <pytest args>– run pytest underuv, collect artifacts, optionally ingest.pytest-chronicle backfill– ingest many summary.json files.pytest-chronicle export-sqlite/import-sqlite– migrate between backends.pytest-chronicle db upgrade– apply Alembic migrations.pytest-chronicle config show|set– view or set repo defaults.
Configuration & defaults
- Precedence: CLI flag
--database-url> env (PYTEST_RESULTS_DB_URL, legacyTEST_RESULTS_DATABASE_URL/SCS_DATABASE_URL) >.pytest-chronicle.toml> fallback SQLite at<repo>/.pytest-chronicle/chronicle.db(async). - Example config:
[chronicle] database_url = "postgresql+asyncpg://user:pass@host/db" project = "my-project" suite = "ci-smoke,linux" # labels/tags (comma-separated)
- Typical flow: use SQLite for local dev (via
init); point env or config at Postgres for CI/prod. No other changes needed. - If you skip
--projectduringinit, it is auto-detected frompyproject.toml(or the current folder name); the CLI tells you how to change it later.
Pytest plugin (auto ingestion)
- Install the package; the
pytest_chronicleplugin is auto-discovered. - If a database is configured via env/config (or fallback SQLite), the plugin will ingest automatically at session end. You can still pass
--chronicle-db <url>to override, or--chronicle-no-ingestto skip. - Default JSONL path:
.artifacts/test-results/chronicle-results.jsonl(created automatically).
More docs
- Detailed guide:
docs/guide.md - Backend abstraction:
docs/storage-backends.md
Metadata
Release files for pytest-chronicle 0.4.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pytest_chronicle-0.4.7.tar.gz | 43.8 kB | Without provenance | Details for pytest_chronicle-0.4.7.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pytest_chronicle-0.4.7-py3-none-any.whl | Python 3 | none | any | Details for pytest_chronicle-0.4.7-py3-none-any.whl |
Total release size: 96.5 kB
Release files / pytest_chronicle-0.4.7.tar.gz
| Download URL | pytest_chronicle-0.4.7.tar.gz |
|---|---|
| Size | 43.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d8c33c532c7045e90c94dc4b6a7a94f9b63e8ee06e0f18305c328f22b262f557
|
|
BLAKE2b-256 checksum How to use checksums |
10ae246a521787998e11fc6ae633c014ef072817ae13ae3b416632ea39efd7b8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.5.15
|
Release files / pytest_chronicle-0.4.7-py3-none-any.whl
| Download URL | pytest_chronicle-0.4.7-py3-none-any.whl |
|---|---|
| Size | 52.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
77bda7ac7fbb04893270744b0e7ae68776e43e27894e64aecde1418877eb47e3
|
|
BLAKE2b-256 checksum How to use checksums |
d74573802cda5b5bfeb4772b3f78a3aab0f5a2aabcc48a984bcba6b9159fd901
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.5.15
|
Security for pytest-chronicle 0.4.7
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.