Pytest snapshot testing utility that enables developers to write tests asserting immutability of computed results.
Overall
score
80%
A small helper that produces deterministic run summaries and relies on snapshot assertions to flag corrupted files and strict type drift before regeneration.
run_id="build-42", metrics={"duration_ms": 1820, "files_written": 3}, and artifacts ["results.json", "log.txt"], the returned summary contains these values, includes an integrity marker {"stable": True}, sorts artifacts alphabetically, and matches the stored snapshot exactly. @testmetrics provides duration_ms as a string instead of an integer, the snapshot assertion fails with a strict type mismatch pointing at the duration path rather than coercing the value. @test@generates
from typing import Dict, List, Any
def build_run_summary(run_id: str, metrics: Dict[str, Any], artifacts: List[str]) -> Dict[str, Any]:
"""
Returns a deterministic summary shaped as:
{
"run_id": run_id,
"metrics": metrics, # expects numeric millisecond durations
"artifacts": sorted(artifacts),
"integrity": {"stable": True}
}
"""Python snapshot testing library used for deterministic snapshot assertions and regeneration workflows.
Install with Tessl CLI
npx tessl i tessl/pypi-syrupyevals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10