{"id":27299,"library":"pytest-insta","title":"pytest-insta","description":"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.","status":"active","version":"0.4.1","language":"python","source_language":"en","source_url":"https://github.com/pytest-dev/pytest-insta","tags":["pytest","snapshot-testing","testing","plugin"],"install":[{"cmd":"pip install pytest-insta","lang":"bash","label":"install"}],"dependencies":[{"reason":"Required for pytest plugin functionality","package":"pytest","optional":false}],"imports":[{"note":"No wrong import common; use as plugin marker","wrong":"","symbol":"pytest_insta","correct":"import pytest_insta"},{"note":"Fixture usage: def test_foo(snapshot): assert snapshot() == value","wrong":"","symbol":"snapshot fixture","correct":"from pytest_insta import snapshot"}],"quickstart":{"code":"# content of test_example.py\nimport pytest\nimport requests\n\ndef test_with_snapshot(snapshot):\n    response = requests.get('https://api.github.com')\n    assert snapshot() == response.json()\n","lang":"python","description":"Basic snapshot test using the snapshot fixture. Run with 'pytest --insta' to record snapshots."},"warnings":[{"fix":"Re-run tests with --insta-update to regenerate snapshots in new format.","message":"Version 0.4.0 changed the default snapshot storage format from .snap to .json. Existing .snap files will not be recognized unless migrated.","severity":"breaking","affected_versions":"<0.4.0"},{"fix":"Use the built-in fixture 'snapshot_name' to specify custom snapshot names.","message":"The 'snapshot' fixture argument 'name' is deprecated in 0.4.0; use 'snapshot_name' fixture instead.","severity":"deprecated","affected_versions":">=0.4.0"},{"fix":"Sort data or use custom serializers. Consider using pytest.approx for floats.","message":"Snapshot tests are not deterministic for unordered data (e.g., dicts with floating point). Snapshots are compared as JSON strings.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Do not import; use the fixture in test function argument: def test_foo(snapshot):","cause":"Trying to import snapshot as a function instead of using the fixture.","error":"AttributeError: module 'pytest_insta' has no attribute 'snapshot'"},{"fix":"Install with pip install pytest-insta and ensure no conftest disables the plugin.","cause":"pytest-insta not installed or not enabled.","error":"pytest: error: unrecognized arguments: --insta"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}