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. No plans to update to newer versions for now, this works just fine with a couple of monkey-patched fixes.
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
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.2.0.tar.gz.
File metadata
- Download URL: run_snapshot_tests-0.2.0.tar.gz
- Upload date:
- Size: 51.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
639f547216fe7fe5333c3785486e7b8533d93dbeae249c146a0228d015b89494
|
|
| MD5 |
9d7aca33ed8e068b994f994a7d1292b8
|
|
| BLAKE2b-256 |
0338b67eb2618f0e7e417346015b224d1fee40c6c0fb2fb7760b472808277d3e
|
File details
Details for the file run_snapshot_tests-0.2.0-py3-none-any.whl.
File metadata
- Download URL: run_snapshot_tests-0.2.0-py3-none-any.whl
- Upload date:
- Size: 7.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ef028d5ceb0cdf1cfb6a82d40d56fc92eef51268c98bd38d39174f3f4a1cb59a
|
|
| MD5 |
0a3280388146d2079abeac24476ea299
|
|
| BLAKE2b-256 |
630e77dc94bac0008cf2fdd336c70fef748c7dd948488ff345e5b3ffa65ee586
|