--- id: snapshottest version: "0.6.0" license: MIT license_treatment: permissive maintenance: dormant --- # snapshottest — Snapshot testing for pytest, unittest, Django, and Nose License: permissive · Maintenance: dormant · Downloads: 488.5K/mo ## What it is and what it does Snapshot testing lets you capture the state of an API response or other serializable output once, store it as a reference file, and then automatically compare future test runs against that snapshot. Instead of writing explicit assertions for every field in a response, you assert that the output matches the saved snapshot; if it changes, the test fails and you can review the diff to decide whether the change is expected (and update the snapshot) or a regression. The package integrates with pytest, unittest, Django, and nose, so it fits into existing test suites. It depends on six, termcolor, and fastdiff to handle cross-version compatibility, colored diff output, and efficient comparison. The workflow is: write a test that calls your API, call snapshot.assert_match() or self.assertMatchSnapshot(), and on first run it saves the response; on subsequent runs it compares. You can update snapshots in bulk with a command-line flag when changes are intentional. Use it for: - Testing REST API endpoints by capturing and comparing full JSON responses without hand-writing field assertions - Regression testing UI component serialization or GraphQL query results across code changes - Validating complex nested data structures where manual assertion would be tedious and brittle - Bulk-updating test expectations after intentional API schema changes using --snapshot-update - Documenting expected API behavior by reviewing snapshot diffs in version control ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Snapshot testing library that captures API responses or other serializable outputs and compares them against stored reference snapshots, supporting pytest, unittest, Django, and nose test runners. Yes, with caution on maintenance. Snapshot testing is a proven pattern and this package is stable and widely used. However, it has been dormant since 2020-09-29 with no recent commits—if you need active maintenance, bug fixes, or support for cutting-edge test frameworks, consider whether a more actively maintained alternative fits your timeline. For established projects with stable test suites, it remains a solid choice. ## Install pip install snapshottest uv add snapshottest poetry add snapshottest ## Installing snapshottest Before you install: Low friction install with three lightweight runtime dependencies (six, termcolor, fastdiff). Maintenance is dormant—last release was 2020-09-29 and no commits since 2024-08-01—so expect no active bug fixes or feature development, though the package is marked Production/Stable. License in practice: MIT license is permissive; you can use, modify, and distribute this package freely in commercial and open-source projects with minimal restrictions. Quickstart: pip install snapshottest # With pytest: from snapshottest import snapshot def test_api(snapshot): response = api.client.get('/me') snapshot.assert_match(response) # With unittest: from snapshottest import TestCase class APITest(TestCase): def test_api(self): response = api.client.get('/me') self.assertMatchSnapshot(response) Verify before relying: - Whether the package works reliably with modern Python versions beyond 3.8, given the last release was 2020-09-29 - Current compatibility status with recent versions of pytest, unittest, and Django test runners - Whether dormant status means critical bugs or security issues would go unpatched ## Package facts - License: MIT (permissive) - Python support: unspecified - Install friction: low - Maintenance: dormant - Downloads: 488.5K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags snapshot testing, api response testing, regression testing, pytest snapshot, unittest snapshot assertions, golden file testing, automated test comparison, testing, regression-testing, api-testing [View on SkillFed](https://skillfed.io/packages/snapshottest) · [View on PyPI](https://pypi.org/project/snapshottest/)