test_cli_surface.py¶
tests/test_cli_surface.py
The covered command line cannot change unnoticed (PS2, owner Q/A 2026-11-19).
test_the_committed_cli_surface_is_current
None test_cli_surface.test_the_committed_cli_surface_is_current()
docs/cli-surface.json equals the generated surface.
Checks
assert committed == cli_surface(), ("the covered CLI changed — regenerate with " "`.venv/bin/python -m clew.cli_surface > docs/cli-surface.json`; a removed or renamed " "verb or flag is a major bump" )
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-CLI-001 | measured | test_the_committed_cli_surface_is_current → cli_surface |
| REQ-DDB-CLI-002 | measured | |
| REQ-DDB-CONFIG-001 | measured | |
| REQ-DDB-WIKI-001 | measured | |
| REQ-DDB-WIKI-035 | measured | |
| REQ-DDB-WIKI-038 | measured | |
| REQ-DDB-WIKI-042 | measured | |
| REQ-DDB-WIKI-043 | measured |
Source · 16 lines
def test_the_committed_cli_surface_is_current() -> None:
"""A REMOVED OR RENAMED verb or flag fails here and is a major bump; an ADDED one is additive
— regenerate.
@brief docs/cli-surface.json equals the generated surface.
"""
from clew.cli_surface import cli_surface
committed = json.loads((Path(__file__).parent.parent / "docs" / "cli-surface.json").read_text())
assert committed == cli_surface(), (
"the covered CLI changed — regenerate with "
"`.venv/bin/python -m clew.cli_surface > docs/cli-surface.json`; a removed or renamed "
"verb or flag is a major bump"
)
Activity · 3 steps
test_the_gate_and_wiki_verbs_are_covered
None test_cli_surface.test_the_gate_and_wiki_verbs_are_covered()
PS2: `clew guard` and `clew wiki` and their subcommands are in the surface.
Checks
assert {"validate", "impact", "coverage"} <= set(surface["clew guard"]["subcommands"])assert {"build", "check", "flow"} <= set(surface["clew wiki"]["subcommands"])assert "--format" in surface["clew guard"]["subcommands"]["validate"]["options"]
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-CLI-001 | measured | test_the_gate_and_wiki_verbs_are_covered → cli_surface |
| REQ-DDB-CLI-002 | measured | |
| REQ-DDB-CONFIG-001 | measured |
Source · 8 lines
def test_the_gate_and_wiki_verbs_are_covered() -> None:
"""@brief PS2: `clew guard` and `clew wiki` and their subcommands are in the surface."""
from clew.cli_surface import cli_surface
surface = cli_surface()
assert {"validate", "impact", "coverage"} <= set(surface["clew guard"]["subcommands"])
assert {"build", "check", "flow"} <= set(surface["clew wiki"]["subcommands"])
assert "--format" in surface["clew guard"]["subcommands"]["validate"]["options"]1 more lines, not shown