run-snapshot-tests
Runner for Python inline-snapshot tests with a better interface and cleaner terminal output.
To run pytest with async functions, install python-asyncio (uv add python-asyncio) and add this setting to the pyproject.toml:
[tool.pytest.ini_options]
asyncio_mode = "auto"
asyncio_default_fixture_loop_scope = "function" # prevents noisy warning message for some python-asyncio plugin versions
Note: only compatible with 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 snapshot, outsource
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 snapshot, outsource, external
from run_snapshot_tests import run_snapshot_tests
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()
Metadata
Release files for run-snapshot-tests 0.3.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| run_snapshot_tests-0.3.3.tar.gz | 52.3 kB | Without provenance | Details for run_snapshot_tests-0.3.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| run_snapshot_tests-0.3.3-py3-none-any.whl | Python 3 | none | any | Details for run_snapshot_tests-0.3.3-py3-none-any.whl |
Total release size: 59.4 kB
Release files / run_snapshot_tests-0.3.3.tar.gz
| Download URL | run_snapshot_tests-0.3.3.tar.gz |
|---|---|
| Size | 52.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b4b2b98d61174d86d4b27b2b7f1d00db89ee7b5080c1f4495da9c5343ccc0942
|
|
BLAKE2b-256 checksum How to use checksums |
2bca8bded1d5df01678e16779bea133c81eed3523e86ad7f59a73bcb038d33b8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.7.2
|
Release files / run_snapshot_tests-0.3.3-py3-none-any.whl
| Download URL | run_snapshot_tests-0.3.3-py3-none-any.whl |
|---|---|
| Size | 7.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a994887121fc7da1d1c08b7cb9f794cd10ecf88ff78deaa00c74fd42577dfd8e
|
|
BLAKE2b-256 checksum How to use checksums |
cd1774f04a8e039391579077d01371b2815b165e805b0a81bf0345665a022124
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.7.2
|
Security for run-snapshot-tests 0.3.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.