Skip to main content

Runner for Python [inline-snapshot](https://github.com/15r10nk/inline-snapshot/) tests with a better interface and cleaner terminal output.

Project description

run-snapshot-tests

Runner for Python inline-snapshot tests with a better interface and cleaner terminal output.

Interface

def run_snapshot_tests(
    path: Union[str, Path, None] = None, # tests path. Defaults to current file if not set
    mode: Literal[
        "assert", 
        "create_missing", 
        "fix_broken", 
        "update_all"
    ] = "create_missing",
) -> None:

Example

from inline_snapshot import outsource, snapshot
from run_snapshot_tests import run_snapshot_tests

def test():
    assert "value" == snapshot()
    assert 5 <= snapshot()
    assert 5 in snapshot()
    a = snapshot()
    assert a["key"] == "value"

    assert (
        outsource(
            "Long data" * 1000,
        )
        == snapshot()
    )


if __name__ == "__main__":
    run_snapshot_tests()

from inline_snapshot import outsource, snapshot
from run_snapshot_tests import run_snapshot_tests

from inline_snapshot import external


def test():
    assert "value" == snapshot('value')
    assert 5 <= snapshot(5)
    assert 5 in snapshot([5])
    a = snapshot({'key': 'value'})
    assert a["key"] == "value"

    assert (
        outsource(
            "Long data" * 1000,
        )
        == snapshot(external("hash:dc9b148c966a*.txt"))
    )


if __name__ == "__main__":
    run_snapshot_tests()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

run_snapshot_tests-0.1.3.tar.gz (44.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

run_snapshot_tests-0.1.3-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file run_snapshot_tests-0.1.3.tar.gz.

File metadata

  • Download URL: run_snapshot_tests-0.1.3.tar.gz
  • Upload date:
  • Size: 44.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.2

File hashes

Hashes for run_snapshot_tests-0.1.3.tar.gz
Algorithm Hash digest
SHA256 86981423b1469d5f3337bd430ada5ef9cab89dcbd167613fef0841550e504e9a
MD5 5bda219fa3cf8f73124a305cc7056ce7
BLAKE2b-256 c2e868b9412e6cb5e9dda26297943923a896cf636602fc0098105b41b4003ecf

See more details on using hashes here.

File details

Details for the file run_snapshot_tests-0.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for run_snapshot_tests-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 5e96bd6da4f3d01c80ff392af8174581e02e6bc15eab5edef46149e35c1d44b5
MD5 3eb74ad2dc0408ba4d1a1790475c7460
BLAKE2b-256 290e34af1bb806224a62cc26d3e805e91d2d71a5f8e50bcfd4cf2307bf63783c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page