Runner for Python inline-snapshot tests with cleaner output and a better interface
Project description
run-snapshot-tests
Runner for Python inline-snapshot tests with cleaner output and a better interface
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 loguru import logger
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 loguru import logger
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.2.tar.gz
(44.1 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file run_snapshot_tests-0.1.2.tar.gz.
File metadata
- Download URL: run_snapshot_tests-0.1.2.tar.gz
- Upload date:
- Size: 44.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d5dd1e0e6132348f5671080217ee505aec7fb63623124efd89a1ac2793eafcd8
|
|
| MD5 |
93a29278de98419cb9d5668d57773faf
|
|
| BLAKE2b-256 |
f321572d390000409ef5f4aad11805e8c2bb3f9252dd5bf9bef4b759c7f58a10
|
File details
Details for the file run_snapshot_tests-0.1.2-py3-none-any.whl.
File metadata
- Download URL: run_snapshot_tests-0.1.2-py3-none-any.whl
- Upload date:
- Size: 6.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2343f6340934f6929e7e93350fb402b62d27cf068ee1a80885ffae0d936ebec9
|
|
| MD5 |
6fc89255d49bf298e18c9eebecad0e34
|
|
| BLAKE2b-256 |
2b22f0ab60c5e704e19e8728ad6036483dcc92eb9f234ec4920fe0b3272cb607
|