pytest-insta
A practical snapshot testing plugin for pytest
What it is and what it does
pytest-insta is a snapshot testing plugin for pytest that lets you write assertions by comparing outputs to stored reference values. Instead of hardcoding expected results, you call `snapshot()` in your test and the plugin records the actual output; on subsequent runs, it compares the new output to the stored snapshot and flags differences. The plugin handles multiple snapshot formats out of the box—text, binary, hexdump, JSON, and pickle—and lets you define custom formats by subclassing the `Fmt` class.
The workflow is designed around an interactive review tool. When snapshots differ, you can use `pytest --insta review` to inspect each change in a Python REPL, then accept or reject it. This makes it easy to catch unintended regressions while deliberately approving intentional changes. The plugin also supports batch operations like `--insta update` to accept all changes at once, or `--insta record` to defer review until later. It depends only on pytest and wrapt, keeping the install lightweight.
Use it for:
- Verify that refactored code produces identical output to the original without manually comparing large strings or objects.
- Track changes to JSON or structured data across test runs and approve them interactively rather than rewriting assertions.
- Test code that generates formatted text (logs, reports, code) by storing the output as a snapshot and catching unintended formatting changes.
- Build regression tests for complex data transformations by storing the result once and comparing future runs against it.
- Maintain test assertions for serialized objects (pickle, binary) that would be tedious to hardcode in the test file.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
A pytest plugin that enables snapshot testing by comparing test outputs against stored reference values, with built-in support for text, binary, JSON, and pickle formats plus an interactive review tool.
Yes, with conditions. The plugin is well-designed for snapshot testing workflows and has low install friction. However, the unclear license and aging maintenance (265 days since last release) mean you should verify the license terms and assess whether the project's pace matches your support expectations before adopting it in production. No known vulnerabilities.
Install
pytest-insta on PyPI
pip
pip install pytest-instauv
uv add pytest-instapoetry
poetry add pytest-instaInstalling pytest-insta
Before you install
Low install friction with only two runtime dependencies (pytest and wrapt). Maintenance status is aging—last release was 265 days ago—so expect slower response to issues, though no active vulnerabilities are known.
License in practice
License treatment is unclear; the package metadata does not declare an SPDX license identifier or raw license string, so you should verify the actual license terms in the repository before adopting it in a commercial or restricted context.
Quickstart
pip install pytest-insta
# In a test file:
def test_example(snapshot):
assert snapshot() == "expected output"
# Run with pytest --insta update to record or approve snapshots
Requires Python >=3.10
Verify before relying
- Actual license terms—metadata does not specify SPDX or raw license
- Repository URL and current maintainer activity—metadata lacks project URLs
- Whether aging maintenance status affects bug fixes or compatibility with newer pytest versions
Package facts
| License | not declared (unclear) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — pytest, wrapt |
| Maintenance | aging — 265 days since the last release |
| First released | |
| Downloads | 252,375/month — #8,545 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pytest_insta-0.4.1-py3-none-any.whl
Keywords: pytest-plugin, pytest, testing, snapshot, snapshot-testing
Tags
More Testing packages
Pluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
pytestpytest is a testing framework that lets you…
permissive · top 100 on PyPI
virtualenvvirtualenv creates isolated Python environments…
permissive · top 100 on PyPI
coverageCoverage.py measures which lines of Python code…
permissive · top 1,000 on PyPI
pytest-asynciopytest-asyncio is a pytest plugin that enables…
permissive · top 1,000 on PyPI
pytest-json-ctrfA pytest plugin that generates test reports in…
permissive · top 1,000 on PyPI
inline-snapshotinline-snapshot is a pytest plugin that lets…
permissive · top 5,000 on PyPI
pytest-snapshotA pytest plugin that enables snapshot…
permissive · top 5,000 on PyPI
pytest-playwright-visualA pytest plugin that captures and compares…
permissive · top 15,000 on PyPI
syrupySyrupy is a pytest plugin that enables snapshot…
permissive · top 5,000 on PyPI
snapshot-restore-pyRegisters runtime hooks in AWS Lambda…
permissive · top 5,000 on PyPI
snapshottestSnapshot testing library that captures API…
permissive · top 15,000 on PyPI
pytest-textual-snapshotA pytest plugin that captures SVG screenshots…
permissive · top 15,000 on PyPI
pytest-unorderedProvides a pytest assertion helper to compare…
permissive · top 5,000 on PyPI
pytest-clarityA pytest plugin that displays colored,…
permissive · top 15,000 on PyPI
pytest-regressionsProvides pytest fixtures for writing regression…
permissive · top 5,000 on PyPI