pytest-snapshot
A plugin for snapshot testing with pytest.
Decision gist · record as of 2026-08-14
Yes, if you use pytest and want to reduce assertion boilerplate in tests with large or frequently-changing outputs. The low install friction and permissive license make adoption straightforward. However, maintenance is dormant; verify compatibility with your pytest and Python versions before relying on it for new projects, and monitor the repository for any compatibility issues.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires pytest 3.0+; Python 3.5+.
- Low friction; a single runtime dependency on pytest.
- Maintenance is dormant—last release was 2022-04-23—but the repository remains active and the package is stable at Beta status.
License · maintenance · safety
MIT (permissive) — MIT license is permissive; you may use, modify, and distribute this package freely in commercial and private projects without restriction.
last release 2022-04-23 (1574 days) · last repo commit 2024-07-09 · 138 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 2,603,450 downloads/mo, #2,971 on PyPI
Alternatives
Verify before relying
pip install pytest-snapshot
# In your test file:
def test_output(snapshot):
result = some_function()
snapshot.assert_match(result, 'expected_output.txt')
# Run: pytest --snapshot-update- Whether the dormant maintenance status affects compatibility with recent pytest or Python versions.
- Performance characteristics when snapshot testing large collections or deeply nested structures.
What it is and what it does
pytest-snapshot is a pytest plugin that implements snapshot testing—a pattern where test assertions compare actual output against saved reference files (snapshots) rather than hardcoded expected values. When a function's output changes, you run pytest with --snapshot-update to regenerate snapshots, review the changes, and commit them to version control. This reduces boilerplate in tests and makes it easy to spot when behavior changes unexpectedly.
The plugin works with strings and bytes directly, and supports both single-file snapshots (via assert_match) and directory-based snapshot collections (via assert_match_dir). It gives you full control over snapshot file paths and serialization—you decide how to format output (JSON, YAML, plain text) before passing it to the snapshot method. The design is inspired by Jest's snapshot testing and emphasizes human-readable snapshots that are easy to review in code diffs and pull requests.
Use it for
- Testing formatted output (JSON, YAML, HTML) where manual assertion maintenance is tedious.
- Regression testing large or complex data structures by comparing against golden files.
- Parametrized tests over many input cases, where each case's expected output is stored in a separate snapshot file.
- Verifying that refactoring or API changes produce expected output changes, with easy bulk review via --snapshot-update.
- Organizing test fixtures as readable snapshot files in version control rather than embedded test constants.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you use pytest and want to reduce assertion boilerplate in tests with large or frequently-changing outputs.
The low install friction and permissive license make adoption straightforward. However, maintenance is dormant; verify compatibility with your pytest and Python versions before relying on it for new projects, and monitor the repository for any compatibility issues.
Install
pytest-snapshot on PyPI
Before you install
Low friction; a single runtime dependency on pytest. Maintenance is dormant—last release was 2022-04-23—but the repository remains active and the package is stable at Beta status.
Requires pytest 3.0+; Python 3.5+.
License in practice
MIT license is permissive; you may use, modify, and distribute this package freely in commercial and private projects without restriction.
Quickstart
pip install pytest-snapshot
# In your test file:
def test_output(snapshot):
result = some_function()
snapshot.assert_match(result, 'expected_output.txt')
# Run: pytest --snapshot-update
Verify before relying
- Whether the dormant maintenance status affects compatibility with recent pytest or Python versions.
- Performance characteristics when snapshot testing large collections or deeply nested structures.
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.5 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 1 packagepytest |
| Maintenance | Dormant 1,574 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 2,603,450 / month, #2,971 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 4 - BetaFramework :: PytestIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.5Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Software Development :: Testing |
Evidence: pytest_snapshot-0.9.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “snapshot testing pytest”
- pytest-snapshotA pytest plugin that enables snapshot testing—comparing test outputs…
- pytest-instaA pytest plugin that enables snapshot testing by comparing test…
- syrupySyrupy is a pytest plugin that enables snapshot testing by letting…
Give your agent the search over MCP, or paste the wish link into any chat.
More Testing packages
Pluggy provides a plugin system that lets you define hook specifications and register implementations to be called in sequence, enabling extensible Python applications without tight coupling.
Install it if you're building an extensible application or framework.
pytest is a testing framework that lets you write test functions using plain assert statements and automatically discovers and runs them, with detailed failure reporting.
virtualenv creates isolated Python environments where packages can be installed independently without affecting the system Python or other projects.
Coverage.py measures which lines of Python code are executed during test runs, reporting coverage percentages and identifying untested code paths.
Install it if you want to measure test completeness or enforce coverage thresholds in your project.
pytest-asyncio is a pytest plugin that enables writing and running async test functions using the asyncio library, allowing developers to await code directly within test cases.
Install it if you write tests for any asyncio-based code.
A pytest plugin that generates test reports in Common Test Report Format (CTRF) as JSON, compatible with pytest-xdist and pytest-playwright for distributed and browser-based testing.
Install it if you need CTRF-formatted test output for CI/CD integration or cross-tool reporting.
See also pytest-regressions · snapshottest · syrupy · pytest-insta · inline-snapshot · snapshot-restore-py · expecttest · pytest-textual-snapshot · pytest-icdiff · pytest-logging