72 lines
2.2 KiB
Python
72 lines
2.2 KiB
Python
from __future__ import annotations
|
|
|
|
import importlib.util
|
|
from pathlib import Path
|
|
|
|
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
SCRIPT_PATH = ROOT / "scripts" / "fleet_phase6_network.py"
|
|
DOC_PATH = ROOT / "docs" / "FLEET_PHASE_6_NETWORK.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_compute_phase6_status_tracks_human_free_gate_and_network_buildings() -> None:
|
|
mod = _load_module(SCRIPT_PATH, "fleet_phase6_network")
|
|
|
|
status = mod.compute_phase6_status(
|
|
{
|
|
"resources": {
|
|
"human_free_days": 3,
|
|
},
|
|
"notes": [
|
|
"The network is not yet trusted to run a full week without supervision.",
|
|
],
|
|
}
|
|
)
|
|
|
|
assert status["current_phase"] == "PHASE-6 The Network"
|
|
assert status["phase_ready"] is False
|
|
assert any("3/7" in item for item in status["missing_requirements"])
|
|
assert any("global mesh" in item.lower() or "community contribution" in item.lower() for item in status["current_buildings"])
|
|
|
|
|
|
|
|
def test_render_markdown_preserves_phase6_language_and_buildings() -> None:
|
|
mod = _load_module(SCRIPT_PATH, "fleet_phase6_network")
|
|
status = mod.compute_phase6_status(mod.default_snapshot())
|
|
report = mod.render_markdown(status)
|
|
|
|
for snippet in (
|
|
"# [PHASE-6] The Network - Autonomous Infrastructure",
|
|
"## Phase Definition",
|
|
"## Current Buildings",
|
|
"## Final Milestone",
|
|
"Autonomous issue creation",
|
|
"Community contribution pipeline",
|
|
"Global mesh",
|
|
):
|
|
assert snippet in report
|
|
|
|
|
|
|
|
def test_repo_contains_generated_phase6_doc() -> None:
|
|
assert DOC_PATH.exists(), "missing committed phase-6 network doc"
|
|
text = DOC_PATH.read_text(encoding="utf-8")
|
|
for snippet in (
|
|
"# [PHASE-6] The Network - Autonomous Infrastructure",
|
|
"## Current Buildings",
|
|
"## Next Trigger",
|
|
"## Why This Phase Remains Open",
|
|
):
|
|
assert snippet in text
|