Files
product-vamp/tests/asset_contract.py
khodowany bc7baea7c4
ci / checks (push) Failing after 23m22s
Cleanup
2026-10-08 02:13:45 -05:00

18 lines
842 B
Python

"""Compare complete generated assets with the reviewed, pinned output baseline."""
import hashlib
import json
import pathlib
import sys
def verify(root):
expected = json.loads(pathlib.Path(__file__).with_name('fixtures').joinpath('assets_manifest.json').read_text())
actual = {path.relative_to(root).as_posix(): hashlib.sha256(path.read_bytes()).hexdigest()
for path in sorted(root.rglob('*')) if path.is_file() and path.relative_to(root).parts[0] != 'analysis'}
changed = sorted(name for name in expected.keys() | actual.keys() if expected.get(name) != actual.get(name))
if changed:
raise AssertionError('Generated assets differ from the reviewed baseline:\n' + '\n'.join(changed))
print(f'All {len(expected)} generated assets match the reviewed baseline.')
if __name__ == '__main__':
verify(pathlib.Path(sys.argv[1]))