Registry / testing / pytest-insta

pytest-insta

JSON →
library0.4.1pypypi✓ verified 89d ago

A practical snapshot testing plugin for pytest, providing a simple way to compare test results against stored snapshots. Current version is 0.4.1, with a release cadence of approximately monthly.

pip install pytest-insta
INSTALL
IMPORT
SIG · PYTEST-INSTA
P
pytest-insta
testingpythonv0.4.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

pytest_insta
✓ import pytest_insta
No wrong import common; use as plugin marker
snapshot fixture
✓ from pytest_insta import snapshot
Fixture usage: def test_foo(snapshot): assert snapshot() == value

Basic snapshot test using the snapshot fixture. Run with 'pytest --insta' to record snapshots.

# content of test_example.py import pytest import requests def test_with_snapshot(snapshot): response = requests.get('https://api.github.com') assert snapshot() == response.json()
Debug
Known issues
breakingVersion 0.4.0 changed the default snapshot storage format from .snap to .json. Existing .snap files will not be recognized unless migrated.
fix
Re-run tests with --insta-update to regenerate snapshots in new format.
affects: <0.4.0
deprecatedThe 'snapshot' fixture argument 'name' is deprecated in 0.4.0; use 'snapshot_name' fixture instead.
fix
Use the built-in fixture 'snapshot_name' to specify custom snapshot names.
affects: >=0.4.0
gotchaSnapshot tests are not deterministic for unordered data (e.g., dicts with floating point). Snapshots are compared as JSON strings.
fix
Sort data or use custom serializers. Consider using pytest.approx for floats.
affects: all
Errors
Common errors & fixes
AttributeError: module 'pytest_insta' has no attribute 'snapshot'
Trying to import snapshot as a function instead of using the fixture.
fix
Do not import; use the fixture in test function argument: def test_foo(snapshot):
pytest: error: unrecognized arguments: --insta
pytest-insta not installed or not enabled.
fix
Install with pip install pytest-insta and ensure no conftest disables the plugin.
Upgrade
Version history
0.4.1latest on PyPI · released Nov 22, 2025
Audit
Dependencies
pytestrequiredRequired for pytest plugin functionality
Agent activity
2 hits · last 30 days
node
2
Resources
pytest-insta — pip install pytest-insta · libregistry