Skip to content

Releases: 15r10nk/inline-snapshot

0.18.1

22 Dec 10:50
Compare
Choose a tag to compare

Fixed

  • uv is now only used during test time if you run the inline-snapshot tests with pytest --use-uv
    This solves a problem if you want to package inline-snapshot in distributions (#165)

0.18.0

21 Dec 20:35
Compare
Choose a tag to compare

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

17 Dec 19:51
Compare
Choose a tag to compare

Fixed

  • Code generation for sets is now deterministic.
    def test():
        assert {1j, 2j, 1, 2, 3} == snapshot({1, 1j, 2, 2j, 3})

0.17.0

14 Dec 09:37
Compare
Choose a tag to compare

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

12 Dec 07:36
Compare
Choose a tag to compare

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

10 Dec 20:00
Compare
Choose a tag to compare

Fixed

  • solved a bug caused by a variable inside a snapshot (#148)

Full Changelog: v0.15.0...v0.15.1

v0.15.0

10 Dec 07:18
Compare
Choose a tag to compare

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

07 Dec 12:31
Compare
Choose a tag to compare

Fixed

  • do not crash when handling raw f-strings (rf"",RF"",...) (#143)

Full Changelog: v0.14.1...v0.14.2

v0.14.1

04 Dec 18:08
Compare
Choose a tag to compare

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

10 Nov 21:45
Compare
Choose a tag to compare

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