Files
silver_pose/v1/tests/test_release.py
T

38 lines
1.3 KiB
Python

from pathlib import Path
from v1.release import build_release_package, main, sha256_file
ROOT = Path(__file__).resolve().parents[2]
def test_build_release_copies_locked_model_and_excludes_local_credentials(tmp_path):
model = tmp_path / "best.pt"
model.write_bytes(b"locked-model")
output = tmp_path / "SilverPose-V1"
manifest = build_release_package(ROOT, model, sha256_file(model), output)
assert (output / "v1" / "models" / "best.pt").read_bytes() == b"locked-model"
assert manifest["model_sha256"] == sha256_file(model)
assert not list(output.rglob("config.local.json"))
assert not list(output.rglob("events.jsonl"))
def test_demo_runbook_covers_preflight_evidence_and_scope():
text = (ROOT / "docs" / "demo-runbook.md").read_text(encoding="utf-8")
for heading in ("启动前检查", "现场演示步骤", "证据复查", "适用边界"):
assert heading in text
assert "rtsp://" not in text
def test_release_command_verifies_a_built_package(tmp_path, capsys):
model = tmp_path / "best.pt"
model.write_bytes(b"locked-model")
output = tmp_path / "SilverPose-V1"
build_release_package(ROOT, model, sha256_file(model), output)
assert main(["verify", "--package", str(output)]) == 0
assert "release package verified" in capsys.readouterr().out