test_land_closeout_performance.py file-level

at sha256:a · View file ↗ · Intel ↗

History
1 files
1 commits
0 hotspots
0 🧊 dead
0 💥 blast risk
sha256:8 docs: queue board-identity follow-ups so they survive the session Capt… · aaronrene · Sep 5, 2026
1 """Performance: default status path adds no gh invocation for land closeout
2 (§PMHF.10 performance)."""
3
4 from __future__ import annotations
5
6 import time
7 from pathlib import Path
8
9 from tests.support import git_status_runner, land_a_fence_body, land_handover_text, run_cli, seed_land_repo
10
11
12 def test_default_status_path_never_invokes_gh(tmp_path: Path, capsys) -> None:
13 # Even when the paste names a PR, status (probe_merged_pr=False) must not call gh.
14 seed_land_repo(
15 tmp_path,
16 handover_text=land_handover_text(
17 "cafebabe",
18 fence_body=land_a_fence_body(paste_extra="PR #206 open — waiting for merge.\n"),
19 ),
20 )
21 runner = git_status_runner(tip="cafebabe")
22 code = run_cli(
23 ["status", "--json", "--exit-code"],
24 cwd=tmp_path,
25 runner=runner,
26 json_mode=True,
27 )
28 capsys.readouterr()
29 assert code == 0
30 assert not any(call[0].startswith("gh") for call in runner.calls)
31
32
33 def test_status_with_land_closeout_stays_bounded(tmp_path: Path, capsys) -> None:
34 seed_land_repo(tmp_path)
35 runner = git_status_runner(tip="cafebabe")
36 start = time.monotonic()
37 code = run_cli(
38 ["status", "--json", "--exit-code"],
39 cwd=tmp_path,
40 runner=runner,
41 json_mode=True,
42 )
43 elapsed = time.monotonic() - start
44 capsys.readouterr()
45 assert code == 0
46 assert elapsed < 2.0