Metadata-Version: 2.5
Name: pytest-ditto
Version: 2.0.0b1
Summary: Snapshot testing pytest plugin with minimal ceremony and flexible recorders.
Author-email: Lachlan Taylor <95459213+owlowlyowl@users.noreply.github.com>
Maintainer-email: Lachlan Taylor <95459213+owlowlyowl@users.noreply.github.com>
License-Expression: MIT
License-File: LICENSE
Keywords: pytest,testing
Classifier: Development Status :: 5 - Production/Stable
Classifier: Framework :: Pytest
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Software Development :: Testing
Requires-Python: >=3.12
Requires-Dist: click
Requires-Dist: fsspec
Requires-Dist: msgspec>=0.18
Requires-Dist: pytest>=8.3
Requires-Dist: pyyaml
Requires-Dist: rich
Provides-Extra: dev
Requires-Dist: hatch-vcs>=0.4.0; extra == 'dev'
Requires-Dist: hatch>=1.9.4; extra == 'dev'
Requires-Dist: pre-commit; extra == 'dev'
Provides-Extra: pandas
Requires-Dist: pytest-ditto-pandas; extra == 'pandas'
Provides-Extra: pyarrow
Requires-Dist: pytest-ditto-pyarrow; extra == 'pyarrow'
Description-Content-Type: text/markdown

# pytest-ditto

[![PyPI version](https://badge.fury.io/py/pytest-ditto.svg)](https://badge.fury.io/py/pytest-ditto)
[![Continuous Integration](https://github.com/owlowlyowl/pytest-ditto/actions/workflows/ci.yml/badge.svg)](https://github.com/owlowlyowl/pytest-ditto/actions/workflows/ci.yml)
[![Documentation](https://github.com/owlowlyowl/pytest-ditto/actions/workflows/docs.yml/badge.svg)](https://owlowlyowl.github.io/pytest-ditto/)

Snapshot testing pytest plugin with minimal ceremony and flexible recorders.

**[📖 Documentation](https://owlowlyowl.github.io/pytest-ditto/)**

## Features

- **Snapshot fixture** — record test outputs once, assert they don't change
- **Flexible recorders** — strict JSON by default, built-in YAML, and external recorders for specialised data
- **Remote backends** — store snapshots locally, on S3, in PostgreSQL, Redis, DuckDB, or anywhere via fsspec
- **Named profiles** — reusable, named backend targets with isolated credentials
- **CLI tools** — list, update, prune, lint, and manage snapshots from the command line

## Quick Start

```bash
pip install pytest-ditto
```

```python
import ditto


def fn(x: int) -> int:
    return x + 1


def test_fn(snapshot) -> None:
    result = fn(1)
    assert result == snapshot(result, key="fn")
```

First run records the result. Subsequent runs assert it hasn't changed.

## Recorders

| Mark | Format | Extension |
|------|--------|-----------|
| no mark / `@ditto.json` | strict JSON (default) | `.json` |
| `@ditto.yaml` | YAML | `.yaml` |
| `@ditto.pandas.parquet` | pandas DataFrame | `.pandas.parquet` |
| `@ditto.pyarrow.parquet` | PyArrow Table | `.pyarrow.parquet` |

Strict JSON accepts only exact built-in `None`, `bool`, `int`, finite `float`,
`str`, `list`, and string-keyed `dict` values, recursively. Install external
recorders explicitly for other data models. See the recorder and upgrading
guides before migrating snapshots from pytest-ditto 1.x.

## Documentation

Full documentation is available at **[owlowlyowl.github.io/pytest-ditto](https://owlowlyowl.github.io/pytest-ditto/)**, including:

- [Getting Started](https://owlowlyowl.github.io/pytest-ditto/getting-started/)
- [Guides](https://owlowlyowl.github.io/pytest-ditto/guides/snapshot-fixture/) (recorders, backends, custom plugins)
- [CLI Reference](https://owlowlyowl.github.io/pytest-ditto/cli/)
- [API Reference](https://owlowlyowl.github.io/pytest-ditto/reference/)

## Examples

See [examples/](examples/README.md) for self-contained local, PostgreSQL, Redis, and DuckDB examples.
