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 run_snapshot_tests import run_snapshot_tests, outsource, snapshot
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 run_snapshot_tests import run_snapshot_tests,outsource, snapshot, 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.2.tar.gz
(51.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.3.2.tar.gz.
File metadata
- Download URL: run_snapshot_tests-0.3.2.tar.gz
- Upload date:
- Size: 51.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9f8fc7ae165c2c707c9f6e866cb99c00a0efb62a0c47b0c92e6c685d5e2a5adf
|
|
| MD5 |
287845d27bffe40e9579972c445c8b23
|
|
| BLAKE2b-256 |
74f9ffbee1b7cc123871866f8c1e605e8d76de08290851a96dfe9581e00dbfa9
|
File details
Details for the file run_snapshot_tests-0.3.2-py3-none-any.whl.
File metadata
- Download URL: run_snapshot_tests-0.3.2-py3-none-any.whl
- Upload date:
- Size: 6.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9779e4c0c5e4e229c0f905b573f2b28b529222ca6ae557084af9c95bdcd20c14
|
|
| MD5 |
444a965e101c3e0fe492d9f8a5f05eef
|
|
| BLAKE2b-256 |
6b781a0c76f8a8138f7de852dd51bbb4b14752bbc99e4e02677e660470fd329d
|