fix: commit semantic repair changes
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
# [DEF:test_clean_release_cli:Module]
|
||||
# @RELATION: BELONGS_TO -> SrcRoot
|
||||
# @COMPLEXITY: 3
|
||||
# @PURPOSE: Smoke tests for the redesigned clean release CLI.
|
||||
# @LAYER: Domain
|
||||
@@ -17,6 +18,8 @@ from src.services.clean_release.enums import CandidateStatus, ComplianceDecision
|
||||
from src.scripts.clean_release_cli import main as cli_main
|
||||
|
||||
|
||||
# [DEF:test_cli_candidate_register_scaffold:Function]
|
||||
# @RELATION: BINDS_TO -> test_clean_release_cli
|
||||
def test_cli_candidate_register_scaffold() -> None:
|
||||
"""Candidate register CLI command smoke test."""
|
||||
exit_code = cli_main(
|
||||
@@ -35,6 +38,10 @@ def test_cli_candidate_register_scaffold() -> None:
|
||||
assert exit_code == 0
|
||||
|
||||
|
||||
# [/DEF:test_cli_candidate_register_scaffold:Function]
|
||||
|
||||
# [DEF:test_cli_manifest_build_scaffold:Function]
|
||||
# @RELATION: BINDS_TO -> test_clean_release_cli
|
||||
def test_cli_manifest_build_scaffold() -> None:
|
||||
"""Manifest build CLI command smoke test."""
|
||||
register_exit = cli_main(
|
||||
@@ -81,6 +88,10 @@ def test_cli_manifest_build_scaffold() -> None:
|
||||
assert manifest_exit == 0
|
||||
|
||||
|
||||
# [/DEF:test_cli_manifest_build_scaffold:Function]
|
||||
|
||||
# [DEF:test_cli_compliance_run_scaffold:Function]
|
||||
# @RELATION: BINDS_TO -> test_clean_release_cli
|
||||
def test_cli_compliance_run_scaffold() -> None:
|
||||
"""Compliance CLI command smoke test for run/status/report/violations."""
|
||||
repository = get_clean_release_repository()
|
||||
@@ -181,6 +192,10 @@ def test_cli_compliance_run_scaffold() -> None:
|
||||
assert report_exit == 0
|
||||
|
||||
|
||||
# [/DEF:test_cli_compliance_run_scaffold:Function]
|
||||
|
||||
# [DEF:test_cli_release_gate_commands_scaffold:Function]
|
||||
# @RELATION: BINDS_TO -> test_clean_release_cli
|
||||
def test_cli_release_gate_commands_scaffold() -> None:
|
||||
"""Release gate CLI smoke test for approve/reject/publish/revoke commands."""
|
||||
repository = get_clean_release_repository()
|
||||
@@ -303,3 +318,4 @@ def test_cli_release_gate_commands_scaffold() -> None:
|
||||
|
||||
|
||||
# [/DEF:test_clean_release_cli:Module]
|
||||
# [/DEF:test_cli_release_gate_commands_scaffold:Function]
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
# [DEF:backend.tests.scripts.test_clean_release_tui:Module]
|
||||
# [DEF:TestCleanReleaseTui:Module]
|
||||
# @RELATION: BELONGS_TO -> SrcRoot
|
||||
# @COMPLEXITY: 3
|
||||
# @SEMANTICS: tests, tui, clean-release, curses
|
||||
# @PURPOSE: Unit tests for the interactive curses TUI of the clean release process.
|
||||
# @LAYER: Scripts
|
||||
# @RELATION: TESTS -> backend.src.scripts.clean_release_tui
|
||||
# @INVARIANT: TUI initializes, handles hotkeys (F5, F10) and safely falls back without TTY.
|
||||
|
||||
import os
|
||||
@@ -27,6 +27,8 @@ def mock_stdscr() -> MagicMock:
|
||||
return stdscr
|
||||
|
||||
|
||||
# [DEF:test_headless_fallback:Function]
|
||||
# @RELATION: BINDS_TO -> TestCleanReleaseTui
|
||||
def test_headless_fallback(capsys):
|
||||
"""
|
||||
@TEST_EDGE: stdout_unavailable
|
||||
@@ -44,7 +46,11 @@ def test_headless_fallback(capsys):
|
||||
assert "Use CLI/API workflow instead" in captured.err
|
||||
|
||||
|
||||
# [/DEF:test_headless_fallback:Function]
|
||||
|
||||
@patch("src.scripts.clean_release_tui.curses")
|
||||
# [DEF:test_tui_initial_render:Function]
|
||||
# @RELATION: BINDS_TO -> TestCleanReleaseTui
|
||||
def test_tui_initial_render(mock_curses_module, mock_stdscr: MagicMock):
|
||||
"""
|
||||
Simulates the initial rendering cycle of the TUI application to ensure
|
||||
@@ -77,7 +83,11 @@ def test_tui_initial_render(mock_curses_module, mock_stdscr: MagicMock):
|
||||
assert any("F5 Run" in str(call) for call in addstr_calls)
|
||||
|
||||
|
||||
# [/DEF:test_tui_initial_render:Function]
|
||||
|
||||
@patch("src.scripts.clean_release_tui.curses")
|
||||
# [DEF:test_tui_run_checks_f5:Function]
|
||||
# @RELATION: BINDS_TO -> TestCleanReleaseTui
|
||||
def test_tui_run_checks_f5(mock_curses_module, mock_stdscr: MagicMock):
|
||||
"""
|
||||
Simulates pressing F5 to transition into the RUNNING checks flow.
|
||||
@@ -112,7 +122,11 @@ def test_tui_run_checks_f5(mock_curses_module, mock_stdscr: MagicMock):
|
||||
assert len(app.violations_list) > 0
|
||||
|
||||
|
||||
# [/DEF:test_tui_run_checks_f5:Function]
|
||||
|
||||
@patch("src.scripts.clean_release_tui.curses")
|
||||
# [DEF:test_tui_exit_f10:Function]
|
||||
# @RELATION: BINDS_TO -> TestCleanReleaseTui
|
||||
def test_tui_exit_f10(mock_curses_module, mock_stdscr: MagicMock):
|
||||
"""
|
||||
Simulates pressing F10 to exit the application immediately without running checks.
|
||||
@@ -129,7 +143,11 @@ def test_tui_exit_f10(mock_curses_module, mock_stdscr: MagicMock):
|
||||
assert app.status == "READY"
|
||||
|
||||
|
||||
# [/DEF:test_tui_exit_f10:Function]
|
||||
|
||||
@patch("src.scripts.clean_release_tui.curses")
|
||||
# [DEF:test_tui_clear_history_f7:Function]
|
||||
# @RELATION: BINDS_TO -> TestCleanReleaseTui
|
||||
def test_tui_clear_history_f7(mock_curses_module, mock_stdscr: MagicMock):
|
||||
"""
|
||||
Simulates pressing F7 to clear history.
|
||||
@@ -153,11 +171,17 @@ def test_tui_clear_history_f7(mock_curses_module, mock_stdscr: MagicMock):
|
||||
assert len(app.checks_progress) == 0
|
||||
|
||||
|
||||
# [/DEF:test_tui_clear_history_f7:Function]
|
||||
|
||||
@patch("src.scripts.clean_release_tui.curses")
|
||||
# [DEF:test_tui_real_mode_bootstrap_imports_artifacts_catalog:Function]
|
||||
# @RELATION: BINDS_TO -> TestCleanReleaseTui
|
||||
def test_tui_real_mode_bootstrap_imports_artifacts_catalog(
|
||||
mock_curses_module,
|
||||
mock_stdscr: MagicMock,
|
||||
tmp_path,
|
||||
# [/DEF:test_tui_real_mode_bootstrap_imports_artifacts_catalog:Function]
|
||||
|
||||
):
|
||||
"""
|
||||
@TEST_CONTRACT: bootstrap.json + artifacts.json -> candidate PREPARED with imported artifacts
|
||||
@@ -220,4 +244,4 @@ def test_tui_real_mode_bootstrap_imports_artifacts_catalog(
|
||||
assert artifacts[0].detected_category == "core"
|
||||
|
||||
|
||||
# [/DEF:backend.tests.scripts.test_clean_release_tui:Module]
|
||||
# [/DEF:TestCleanReleaseTui:Module]
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
# [DEF:test_clean_release_tui_v2:Module]
|
||||
# @RELATION: BELONGS_TO -> SrcRoot
|
||||
# @COMPLEXITY: 3
|
||||
# @PURPOSE: Smoke tests for thin-client TUI action dispatch and blocked transition behavior.
|
||||
# @LAYER: Domain
|
||||
# @RELATION: TESTS -> backend.src.scripts.clean_release_tui
|
||||
|
||||
"""Smoke tests for the redesigned clean release TUI."""
|
||||
|
||||
@@ -15,6 +15,8 @@ from src.models.clean_release import CheckFinalStatus
|
||||
from src.scripts.clean_release_tui import CleanReleaseTUI, main
|
||||
|
||||
|
||||
# [DEF:_build_mock_stdscr:Function]
|
||||
# @RELATION: BINDS_TO -> test_clean_release_tui_v2
|
||||
def _build_mock_stdscr() -> MagicMock:
|
||||
stdscr = MagicMock()
|
||||
stdscr.getmaxyx.return_value = (40, 120)
|
||||
@@ -22,7 +24,11 @@ def _build_mock_stdscr() -> MagicMock:
|
||||
return stdscr
|
||||
|
||||
|
||||
# [/DEF:_build_mock_stdscr:Function]
|
||||
|
||||
@patch("src.scripts.clean_release_tui.curses")
|
||||
# [DEF:test_tui_f5_dispatches_run_action:Function]
|
||||
# @RELATION: BINDS_TO -> test_clean_release_tui_v2
|
||||
def test_tui_f5_dispatches_run_action(mock_curses_module: MagicMock) -> None:
|
||||
"""F5 should dispatch run action from TUI loop."""
|
||||
mock_curses_module.KEY_F10 = curses.KEY_F10
|
||||
@@ -40,7 +46,11 @@ def test_tui_f5_dispatches_run_action(mock_curses_module: MagicMock) -> None:
|
||||
run_checks_mock.assert_called_once_with()
|
||||
|
||||
|
||||
# [/DEF:test_tui_f5_dispatches_run_action:Function]
|
||||
|
||||
@patch("src.scripts.clean_release_tui.curses")
|
||||
# [DEF:test_tui_f5_run_smoke_reports_blocked_state:Function]
|
||||
# @RELATION: BINDS_TO -> test_clean_release_tui_v2
|
||||
def test_tui_f5_run_smoke_reports_blocked_state(mock_curses_module: MagicMock) -> None:
|
||||
"""F5 smoke test should expose blocked outcome state after run action."""
|
||||
mock_curses_module.KEY_F10 = curses.KEY_F10
|
||||
@@ -65,6 +75,10 @@ def test_tui_f5_run_smoke_reports_blocked_state(mock_curses_module: MagicMock) -
|
||||
assert app.violations_list
|
||||
|
||||
|
||||
# [/DEF:test_tui_f5_run_smoke_reports_blocked_state:Function]
|
||||
|
||||
# [DEF:test_tui_non_tty_refuses_startup:Function]
|
||||
# @RELATION: BINDS_TO -> test_clean_release_tui_v2
|
||||
def test_tui_non_tty_refuses_startup(capsys) -> None:
|
||||
"""Non-TTY startup must refuse TUI mode and redirect operator to CLI/API flow."""
|
||||
with patch("sys.stdout.isatty", return_value=False):
|
||||
@@ -76,7 +90,11 @@ def test_tui_non_tty_refuses_startup(capsys) -> None:
|
||||
assert "Use CLI/API workflow instead" in captured.err
|
||||
|
||||
|
||||
# [/DEF:test_tui_non_tty_refuses_startup:Function]
|
||||
|
||||
@patch("src.scripts.clean_release_tui.curses")
|
||||
# [DEF:test_tui_f8_blocked_without_facade_binding:Function]
|
||||
# @RELATION: BINDS_TO -> test_clean_release_tui_v2
|
||||
def test_tui_f8_blocked_without_facade_binding(mock_curses_module: MagicMock) -> None:
|
||||
"""F8 should not perform hidden state mutation when facade action is not bound."""
|
||||
mock_curses_module.KEY_F10 = curses.KEY_F10
|
||||
@@ -95,3 +113,4 @@ def test_tui_f8_blocked_without_facade_binding(mock_curses_module: MagicMock) ->
|
||||
|
||||
|
||||
# [/DEF:test_clean_release_tui_v2:Module]
|
||||
# [/DEF:test_tui_f8_blocked_without_facade_binding:Function]
|
||||
|
||||
Reference in New Issue
Block a user