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.

Note: Requires inline-snapshot==0.8.0.

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",
    python_functions: Optional[str] = None, # Space-separated globs for function name patterns to collect as tests. Default is "test_*"
) -> 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.3.1.tar.gz (51.1 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.3.1-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for run_snapshot_tests-0.3.1.tar.gz
Algorithm Hash digest
SHA256 20e939e569952f4237228457639305ca248a92158937912e073e7a6b90e59ca3
MD5 f64da91fbefaca63b1284a4a2da106ba
BLAKE2b-256 f0bf09e2539317066d481944fa059aa09399d9b973af4dab6e49352c36697b9c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for run_snapshot_tests-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 70cbc88c6b71c0e5539d12e8ef3052acc77ac30281d405606a05138681e38fd9
MD5 aeb4977761ab0d3726b09dfaf9bec148
BLAKE2b-256 08ac1107b2640abd60339bbef5ce58611e974cae4cc3d6f643c53755484e1b50

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