test_q2_ok_cli_unit.py python
44 lines 1.3 KB
Raw
sha256:a78e7e5a8740e03315f325d19edeb3aa1b306b3337d04abbaa9a9e0f3bbeb7a1 docs: MuseHub-first before ISR #74 — staging solidify NEXT Human 1 day ago
1 """Unit tests for Track Q / Q2b OK CLI entrypoint (§Q2A.10)."""
2
3 from __future__ import annotations
4
5 import os
6 import stat
7 from io import StringIO
8
9 from cli.main import build_parser
10 from tests.support import KIT_ROOT, OVERSEER_DEPRECATION_LINE
11
12
13 def test_ok_shim_exists_executable_and_forwards_to_python_main() -> None:
14 path = KIT_ROOT / "cli" / "ok"
15 assert path.is_file()
16 mode = path.stat().st_mode
17 assert mode & stat.S_IXUSR
18 text = path.read_text(encoding="utf-8")
19 assert "python -m cli.main" in text
20 assert OVERSEER_DEPRECATION_LINE.strip() not in text
21
22
23 def test_overseer_shim_exists_executable_with_exact_deprecation_line() -> None:
24 path = KIT_ROOT / "cli" / "overseer"
25 assert path.is_file()
26 mode = path.stat().st_mode
27 assert mode & stat.S_IXUSR
28 text = path.read_text(encoding="utf-8")
29 assert "python -m cli.main" in text
30 assert f'echo "{OVERSEER_DEPRECATION_LINE.strip()}" >&2' in text
31
32
33 def test_argparse_prog_is_ok() -> None:
34 parser = build_parser()
35 assert parser.prog == "ok"
36
37
38 def test_help_usage_spells_ok() -> None:
39 parser = build_parser()
40 buffer = StringIO()
41 parser.print_help(file=buffer)
42 help_text = buffer.getvalue()
43 assert "usage: ok" in help_text
44 assert "usage: overseer" not in help_text
File History 1 commit
sha256:a78e7e5a8740e03315f325d19edeb3aa1b306b3337d04abbaa9a9e0f3bbeb7a1 docs: MuseHub-first before ISR #74 — staging solidify NEXT Human 1 day ago