pytest-ditto
Snapshot testing pytest plugin with minimal ceremony and flexible recorders.
Features
- Snapshot fixture: record a test's output once, then fail when it changes
- Recorders: strict JSON by default, built-in YAML, and plugins for pandas, polars, PyArrow and pickle
- Storage backends: keep snapshots next to your tests, on S3 or anywhere fsspec reaches, or in your own backend for a database such as Redis
- Lock file: a committed
ditto.lockrecords every snapshot, so CI fails on missing or stale ones - CLI: update, verify, prune, list and inspect snapshots
Quick Start
pip install pytest-ditto
def summarise(prices):
return {"count": len(prices), "total": sum(prices)}
def test_summarise(snapshot):
result = summarise([3, 4.5])
assert result == snapshot(result, key="summary")
The first run stores the result as a snapshot. Every later run compares the
result with it, and fails if it has changed. Run ditto verify in CI so a
missing snapshot fails instead of being recorded again.
Upgrading from 1.x? Read Upgrading to 2.0 first: 2.0 doesn't find snapshots recorded by 1.x.
Documentation
Full documentation is at owlowlyowl.github.io/pytest-ditto:
Examples
See examples/ for self-contained local, PostgreSQL, Redis and DuckDB backends.
Metadata
Release files for pytest-ditto 2.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pytest_ditto-2.0.0.tar.gz | 73.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pytest_ditto-2.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 165.7 kB
Release files / pytest_ditto-2.0.0.tar.gz
| Download URL | pytest_ditto-2.0.0.tar.gz |
|---|---|
| Size | 73.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f8573720ff3aaa6d90b1ac04b00a26abe47765adc1cf1b524b79d76dea208e62
|
|
BLAKE2b-256 checksum How to use checksums |
b36e8d9817d622e7953efa55b67759877c6fea5f13c1ac62a023f61029276709
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 7, 2026.
Transparency logRelease files / pytest_ditto-2.0.0-py3-none-any.whl
| Download URL | pytest_ditto-2.0.0-py3-none-any.whl |
|---|---|
| Size | 91.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9a8b60db6e0df4188d921a7df25915be2e998672cc6df59d1570bf76f32b7153
|
|
BLAKE2b-256 checksum How to use checksums |
128f9b01437ee77327d012908a6ececb7910698474dd964cf43e84f7fa555d32
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 7, 2026.
Transparency log