Releases: 15r10nk/inline-snapshot
0.18.1
0.18.0
Added
- Support for a new
storage-dir
configuration option, to tell inline-snapshot where to store data files such as external snapshots.
Fixed
-
pydantic v1 is supported again. pydantic v1 & v2 create now the same snapshots. You can use
.dict()
to get the same snapshots like in inline-snapshot-0.15.0 for pydantic v1.class M(BaseModel): name: str def test_pydantic(): m = M(name="Tom") assert m == snapshot(M(name="Tom")) assert m.dict() == snapshot({"name": "Tom"})
-
Find
pyproject.toml
file in parent directories, not just next to the Pytest configuration file.
0.17.1
0.17.0
Added
-
attrs can now contain unmanaged values
import datetime as dt import uuid import attrs from dirty_equals import IsDatetime from inline_snapshot import Is, snapshot @attrs.define class Attrs: ts: dt.datetime id: uuid.UUID def test(): id = uuid.uuid4() assert Attrs(dt.datetime.now(), id) == snapshot( Attrs(ts=IsDatetime(), id=Is(id)) )
v0.16.0
Added
inline_snapshot.extra.warns
to captures warnings and compares them against expected warnings.def test_warns(): with warns(snapshot([(8, "UserWarning: some problem")]), include_line=True): warn("some problem")
Full Changelog: v0.15.1...v0.16.0
v0.15.1
v0.15.0
Added
-
snapshots inside snapshots are now supported.
assert get_schema() == snapshot( [ { "name": "var_1", "type": snapshot("int") if version < 2 else snapshot("string"), } ] )
-
runtime values can now be part of snapshots.
from inline_snapshot import snapshot, Is current_version = "1.5" assert request() == snapshot( {"data": "page data", "version": Is(current_version)} )
-
f-strings can now also be used within snapshots, but are currently not fixed by inline-snapshot.
Changed
- dirty-equals expressions are now treated like runtime values or snapshots within snapshots and are not modified by inline-snapshot.
Fixed
-
inline-snapshot checks now if the given command line flags (
--inline-snapshot=...
) are valid -
Example(...).run_pytest(raise=snapshot(...))
uses now the flags from the current run and not the flags from the Example.
Full Changelog: v0.14.2...v0.15.0
v0.14.2
v0.14.1
Fixed
-
Don't crash for snapshots like
snapshot(f"")
(#139)
It first appeared with pytest-8.3.4, but already existed before for cpython-3.11.
f-strings in snapshots are currently not official supported, but they should not lead to crashes. -
skip formatting if black returns an error (#138)
Full Changelog: v0.14.0...v0.14.1
v0.14.0
Added
- command line shortcuts can be defined to simplify your workflows.
--review
and--fix
are defined by default. See the documentation for details.
Removed
- removed the
"Programming Language :: Python :: Implementation :: PyPy"
classifier which was incorrect, because inline-snapshot can not fix snapshots on pypy.
inline-snapshot now enforces--inline-snapshot=disable
when used with an implementation other than cpython, which allows it to be used in packages that want to support pypy.
Changed
--inline-snapshot=create/fix/trim/update
will no longer show reports for other categories.
You can use--inline-snapshot=create,report
if you want to use the old behaviour.
Full Changelog: v0.13.4...v0.14.0