NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
PyPI · #2710 most downloaded on PyPI
golden master/snapshot/approval testing library which puts the values right into your source code
Last release 2 days ago
02 Oct 2026
Ships fairly regularly
a new release about every 2 weeks
Nearly every release is documented
notes for 60 of the last 60 stable releases
Nothing withdrawn
no release was ever pulled
4 years old
104 releases · first in 2022
One column per quarter.
The customize hook now receives a snapshot_value argument with the corresponding existing snapshot value, or ... when there is no corresponding snapsh
customize hook now receives a snapshot_value argument with the... when there is noPrevented --inline-snapshot=trim from changing snapshots when a test body fails or pytest is limited with -k , a test path, or a test node ID. Skipped
Prevented --inline-snapshot=trim from changing snapshots when a test body
fails or pytest is limited with -k, a test path, or a test node ID. Skipped
tests and fixture teardown errors do not prevent trimming. A message now
explains why trimming was disabled when it was requested implicitly. An
explicit --inline-snapshot=trim overrides this safeguard.
Fixed a crash during session finalization when pytest's capture plugin is disabled.
Added Builder.create_set() for creating set expressions in customization functions.
Builder.create_set() for creating set expressions in customizationFixed set snapshot serialization to be deterministic for partially ordered values
such as incomparable frozenset members.
Fixed a crash when an unknown --inline-snapshot flag is provided, without running report finalization or modifying external snapshot tracking files.
bump: version 0.35.1 → 0.35.2
bump: version 0.35.1 → 0.35.2
PYTHONPATH, PYTHONWARNINGS, and PYTHONDONTWRITEBYTECODEbump: version 0.35.0 → 0.35.1
bump: version 0.35.0 → 0.35.1
PYTEST_DISABLE_PLUGIN_AUTOLOAD and PYTEST_PLUGINS while running the test suite.bump: version 0.34.2 → 0.35.0
bump: version 0.34.2 → 0.35.0
inline-snapshot now tracks source files that use external() in .inline-snapshot/files_using_external.txt (inside storage-dir) and uses this tracked list to detect and trim unused external snapshots.
The tool.inline-snapshot.test-dir configuration option is only used as a compatibility fallback when files_using_external.txt does not exist yet.
Documentation examples now use rich terminal snapshots to show pytest output with colors and formatting.
Fixed snapshot updates when pytest reuses stale assertion-rewrite cache files after a test folder is moved, which could leave cached code objects poin
Fixed snapshot_arg() to use the fix category (instead of create) when creating an argument with an existing non-ellipsis default argument value.
snapshot_arg() to use the fix category (instead of create) when creating an argument with an existing non-ellipsis default argument value.get_snapshot_value() now accepts a which parameter ("new" or "old") to select whether to return the new (just-compared) or the old (previously stored)
get_snapshot_value() now accepts a which parameter ("new" or "old") to select whether to return the new (just-compared) or the old (previously stored) snapshot value (#336).Example.run_pytest: deterministic test order by using -p no:ranodmly`snapshot_arg()`, which lets you move snapshot() calls from the call site into the helper function itself.
snapshot_arg(), which lets you move snapshot() calls from the call site into the helper function itself.
Example.format(): new method to format a Python file in the example using Black.
Example.is_formatted(): new method to check whether a Python file in the example is already Black-formatted.
Example.run_inline: exception strings in raises are now formatted the same way inline_snapshot.extra.raises does, which is shorter for small assertions like raises=snapshot("UsageError: default value cannot be a Custom value").
Example.run_inline: the raises, stderr, and changed_files arguments are now handled with snapshot_arg(), so snapshot() is no longer needed at the call site. raises defaults to "<no exception>" and changed_files defaults to {}.
Example.run_inline: the reported_categories argument is now handled with snapshot_arg() and its type changed from list[Category] to set[Category]. It is now only asserted when the reported categories differ from the CLI flags passed via args.
Example.run_pytest: the returncode, error, stderr, changed_files, and outcomes arguments are now handled with snapshot_arg(), so snapshot() is no longer needed at the call site. returncode defaults to 0, changed_files defaults to {}, and outcomes defaults to {"passed": 1}.
Example.run_pytest: the error assertion is now only performed on Python ≥ 3.11.
Example.run_pytest: stdout and stderr are now printed as Rich panels instead of plain text.
extra.raises: the exception argument is now handled with snapshot_arg(), so snapshot() is no longer needed at the call site.
extra.prints: the stdout and stderr arguments are now handled with snapshot_arg(), so snapshot() is no longer needed at the call site.
extra.warns: the expected_warnings argument is now handled with snapshot_arg(), so snapshot() is no longer needed at the call site.
extra.Transformed and extra.transformation: the value argument is now handled with snapshot_arg().
repr(external_file(...)) to use a path relative to the calling file instead of the absolute path, which also fixes incorrect reprs on Windows.Fixed snapshot comparison for dicts where keys are dataclass instances (or other custom objects used as dict keys), which previously caused corrupted
3 + 3) are preserved when elements are removed from or added to a tuple.Pydantic models, attrs and dataclasses with NewType-typed fields now generate correct snapshots that wrap the field value with the NewType constructor
NewType-typed fields now generate correct snapshots that wrap the field value with the NewType constructor (e.g. Something(some_id=SomeID(1)) instead of Something(some_id=1)). This could only be fixed for Python >= 3.10.Fixed a bug where tuples used as snapshot keys caused problems because they had the same hash value
Added context_managers parameter to Example.run_inline(), allowing tests to inject context managers (e.g. unittest.mock.patch) that are active during
context_managers parameter to Example.run_inline(), allowing tests to inject context managers (e.g. unittest.mock.patch) that are active during show_report().UsageError("unmanaged values can not be compared with snapshots") raised during session teardown when using -k to filter tests (#355). This was caused by inline-snapshot trying to update snapshots that were never compared. This is a rare edge case that caused problems when matchers were used, so it has been removed.Improved performance of snapshot() by using lazy evaluation.
snapshot() by using lazy evaluation.builder.create_call().Tuples in snapshots were converted internally into lists if they were evaluated more than once
Fixed handling of datetime and time objects with timezone information. The tzinfo parameter is now properly included in snapshots, and timezone.utc is
Fixed handling of datetime and time objects with timezone information. The tzinfo parameter is now properly included in snapshots, and timezone.utc is represented with the correct import (from datetime import timezone).
Fixed customize hook registration to properly check if objects are functions before inspecting the inline_snapshot_impl attribute, preventing potential attribute errors when scanning conftest modules.
Deprecated @customize_repr which can be replaced with @customize.
pathlib.Path/PurePath values are now never stored as Posix/WindowsPath or their Pure variants, which improves the writing of platform independent tests.@customize.datetime.datetime, date, time, and timedelta that generate clean snapshots with proper imports.__file__ instead of the filename string of the current source file.IsNow() instead of the current datetime when the time value equals the current time.@customize_repr which can be replaced with @customize.raises catches BaseException instead of Exception. This ensures that SystemExit and KeyboardInterrupt are also caught.
pytest --color flag is now respected
Format commands with pipelines (using |) now properly fail when any command in the pipeline returns a non-zero exit code (#320). Previously, only the
|) now properly fail when any command in the pipeline returns a non-zero exit code (#320). Previously, only the last command's exit code was considered, which could allow formatting to succeed even when intermediate commands failed.BREAKING CHANGE: An exception is now raised when you use external() in files that are not inside your tests/ directory (or any other directory that yo…
BREAKING CHANGE: An exception is now raised when you use external() in files that are not inside your tests/ directory (or any other directory that you can configure with tool.inline-snapshot.test-dir).
Users are now notified if they use the same UUID for multiple external snapshots, which can happen when copying one test as a template for a new test. The snapshots should be reset to an empty external() and recreated with inline-snapshot.
Disable ensure ascii in json.dump to support non-ASCII characters in external files
The test-dir config option can now also be a list of paths
The test-dir config option can now also be a list of paths (#307)
added Python 3.14 support
External.run_inline() now uses the same logic as External.run_pytest.
External.run_inline() now uses the same logic as External.run_pytest.# -*- coding: windows-1251 -*- (#305).xdist is now detected properly.
fixed string formatting with black which caused invalid snapshots
fixed string formatting with black which caused invalid snapshots (#301)
assert " a " == snapshot("a")
Example.run_inline can now be used with ["--inline-snapshot=disable"].
Example.run_inline can now be used with ["--inline-snapshot=disable"].--inline-snapshot=report now shows the same changes for external snapshots as --inline-snapshot=review (#298).external_file("some_non_existing_file.txt").handle in cases where pytest_unconfigure is called but not pytest_configure
pytest_unconfigure is called but not pytest_configure (#293)Added `get_snapshot_value()`, which removes all snapshot-specific wrappers and returns only the value of the snapshot.
get_snapshot_value(), which removes all snapshot-specific wrappers and returns only the value of the snapshot.Improved documentation for inline_snapshot.testing.Example.
inline_snapshot.testing.Example.from inline_snapshot import snapshot
def test_a():
assert "" == snapshot(
"""
a
b\
"""
)
Added explicit type hints to the outsource() function
outsource() functionAdded `inline_snapshot.extra.Transformed` and `inline_snapshot.extra.transformation` which can be used to transform values inside of snapshots.
Added inline_snapshot.extra.Transformed and inline_snapshot.extra.transformation which can be used to transform values inside of snapshots.
exposed @declare_unmanaged which allows you to create your own unmanaged types.
You now have to specify test-dir in your pyproject.toml when you save your tests in a folder other than tests/ in your project root (#272).
test-dir in your pyproject.toml when you save your tests in a folder other than tests/ in your project root (#272).pyproject.toml is now also located based on the current directory and the pytest-root, which solves problems when you use inline-snapshot with uv-workspaces (#272).## Fixed - cleanup temporary path
solved incompatibility with pytest\_pretty
Terminal with is preserved (#212)
solved incompatibility with pytest_pretty (#265)
improved performance by checking for "external" in the code string before parsing the code and checking the AST (#272).
Removed unnecessary uuid7 dependency introduced in 0.25.0
external_file() now follows the aliases defined by register_format_alias().BREAKING CHANGE: You now have to declare format aliases if you used outsource() with a different suffix than .txt or .bin in the past.
external() implementation with support for different data formats.@register_format.external() can now be used without snapshot(), such as assert "long text" == external() or inside snapshots like dirty-equals.BREAKING CHANGE: You now have to declare format aliases if you used outsource() with a different suffix than .txt or .bin in the past.
from inline_snapshot import register_format_alias, external
# Can be declared in conftest.py
register_format_alias(".html", ".txt")
def test_html():
assert outsource("<html></html>", suffix=".html") == snapshot()
Add/fix reproducible standard repr for functions
Add/fix reproducible standard repr for functions
added llms.txt to make the documentation for llms more accessible.
Improved the explanation of what it means when snapshots are disabled in CI runs (#226).
Added extra information to the reported failure when snapshots are fixed or created (#240).
fixed the representation of empty strings in sub-snapshots from triple-quotes to single-quotes assert ""==snapshot({5: ""})[5] (#258).
fix: changed format-command default to "" (#256).
The readline module doesn't have to be installed on non-windows systems.
readline module doesn't have to be installed on non-windows systems.changed how the Snapshot[T] type is implemented.
Snapshot[T] type is implemented.snapshot updates are now disabled by default. They be enabled with show-updates=true in your config. This is done because they can confuse new inline-
show-updates=true in your config. This is done because they can confuse new inline-snapshot users and does not fit the way how most users work with inline-snapshot. updates will become much more useful when (#177) is implemented.A pycharm environment is no longer incorrectly recognized as a CI environment.
show correct diff when pytest --inline-snapshot=report -vv is used
pytest --inline-snapshot=report -vv is used (#231)The environment variable INLINE_SNAPSHOT_DEFAULT_FLAGS now takes precedence over all default flags defined in *pyproject.toml*.
The environment variable INLINE_SNAPSHOT_DEFAULT_FLAGS now takes precedence over all default flags defined in pyproject.toml.
inline-snapshot can now be used in combination with pytester.runpytest()
You can now use the config option skip-snapshot-updates-for-now to skip the reporting of updates. But be aware that this option might not be there for
skip-snapshot-updates-for-now to skip the reporting of updates.
But be aware that this option might not be there forever. Please create an issue if you think that the creation of snapshots can be improved.Allowed inline-snapshot to work when pytest-xdist is disabled with -n 0.
-n 0.repr(Is(x)) returns the same value as repr(x) to provide nice pytest outputs
repr(Is(x)) returns the same value as repr(x) to provide nice pytest outputs (#217)trailing white spaces in multi-line strings are now terminated with an \n\. ` python def test_something(): assert "a \nb\n" == snapshot( """\ a \n\ b
\n\.def test_something():
assert "a \nb\n" == snapshot(
"""\
a \n\
b
"""
)
def test_something (): assert "a \n b \n " == snapshot ( """\ a \n\ b """ )
inline-snapshot uses now --inline-snapshot=disable during CI runs by default. This improves performance because snapshot() is then equal to: ` python
inline-snapshot uses now --inline-snapshot=disable during CI runs by default.
This improves performance because snapshot() is then equal to:
def snapshot(x):
return x
It also has benefits for the accuracy of your tests as it is less likely that inline snapshot will affect your tests in CI.
The default flags have changed for cpython >= 3.11:
--inline-snapshot=create,review is used in an interactive terminal and--inline-snapshot=report otherwise.The categories in the terminal output are now links to the documentation if it is supported by the terminal.
Use of the correct snapshot category (update/fix) when deleting dataclass arguments.
--inline-snapshot=create preserves test failures now.
--inline-snapshot=create preserves test failures now.inline-snapshot now also works if you use --no-summary (which pycharm does if you run your tests from the IDE).
--no-summary (which pycharm does if you run your tests from the IDE).Tests with failed snapshot comparisons now always result in a pytest Error, even if snapshots have been fixed or created.
Error, even if snapshots have been fixed or created.Do not skip snapshots in conditional marked xfail tests. ``` python @pytest.mark.xfail(False, reason="...") def test_a(): assert 5 == snapshot(3) # <-
@pytest.mark.xfail(False, reason="...")
def test_a():
assert 5 == snapshot(3) # <- this will be fixed
@pytest.mark.xfail(True, reason="...")
def test_b():
assert 5 == snapshot(3) # <- this not
@pytest . mark . xfail ( False , reason = "..." ) def test_a (): assert 5 == snapshot ( 3 ) # <- this will be fixed @pytest . mark . xfail ( True , reason = "..." ) def test_b (): assert 5 == snapshot ( 3 ) # <- this not
correct normalization of "python3.9" to "python" in tests
Prevent a crash if a value cannot be copied and a UsageError is raised.
Use the black API directly to format python code. This solves issues with the upcomming click 8.2.0 (#202) and problems in multithreading (https://git
<a id='changelog-0.20.2'></a>
snapshots inside tests which are marked as xfail are now ignored
snapshots inside tests which are marked as xfail are now ignored (#184)
Fixed a crash caused by the following code:
snapshot(tuple())
# or
snapshot(dict())
Fixed a windows bug with the readline module
pytest assert rewriting works now together with inline-snapshot if you use cpython>=3.11
pytest assert rewriting works now together with inline-snapshot if you use cpython>=3.11
... is now a special value to create snapshot values.
The value change in assert [5,4] == snapshot([5,...]) is now a create (previously it was a fix)
fixed some issues with dataclass arguments
fixed an issue where --inline-snapshot=review discarded the user input and never formatted the code if you used cpython 3.13.
raise no assertion for positional arguments inside constructor methods.
Your coding agent can read these notes before it upgrades. Set up the MCP server →