56 lines
1.8 KiB
Python
56 lines
1.8 KiB
Python
"""Durable evidence trail for issue #545 verification.
|
|
|
|
Refs: #545, #782, #783, PR #719, issue comment #57028.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import importlib.util
|
|
from pathlib import Path
|
|
|
|
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
SCRIPT_PATH = ROOT / "scripts" / "unreachable_horizon.py"
|
|
DOC_PATH = ROOT / "docs" / "UNREACHABLE_HORIZON_1M_MEN.md"
|
|
VERIFICATION_DOC_PATH = ROOT / "docs" / "issue-545-verification.md"
|
|
|
|
|
|
def _load_module(path: Path, name: str):
|
|
assert path.exists(), f"missing {path.relative_to(ROOT)}"
|
|
spec = importlib.util.spec_from_file_location(name, path)
|
|
assert spec and spec.loader
|
|
module = importlib.util.module_from_spec(spec)
|
|
spec.loader.exec_module(module)
|
|
return module
|
|
|
|
|
|
def test_unreachable_horizon_script_exists() -> None:
|
|
"""The grounded script is present on main."""
|
|
assert SCRIPT_PATH.exists(), "scripts/unreachable_horizon.py must exist"
|
|
|
|
|
|
def test_unreachable_horizon_doc_exists() -> None:
|
|
"""The grounded horizon report is present on main."""
|
|
assert DOC_PATH.exists(), "docs/UNREACHABLE_HORIZON_1M_MEN.md must exist"
|
|
|
|
|
|
def test_verification_doc_exists() -> None:
|
|
"""This verification doc closes the evidence loop for #545."""
|
|
assert VERIFICATION_DOC_PATH.exists(), (
|
|
"docs/issue-545-verification.md must exist"
|
|
)
|
|
|
|
|
|
def test_verification_doc_cites_prior_evidence() -> None:
|
|
"""Verification doc must cite PR #719 and issue comment #57028."""
|
|
text = VERIFICATION_DOC_PATH.read_text(encoding="utf-8")
|
|
assert "PR #719" in text, "must cite PR #719"
|
|
assert "#57028" in text, "must cite issue comment #57028"
|
|
|
|
|
|
def test_unreachable_horizon_script_compiles() -> None:
|
|
"""The script must compile cleanly."""
|
|
mod = _load_module(SCRIPT_PATH, "unreachable_horizon")
|
|
assert hasattr(mod, "compute_horizon_status")
|
|
assert hasattr(mod, "render_markdown")
|