semantics

This commit is contained in:
2026-05-26 09:30:41 +03:00
parent 1e7bcecaea
commit 9ffa8af1dc
623 changed files with 28045 additions and 26557 deletions

View File

@@ -1,8 +1,8 @@
# [DEF:TestCleanReleaseTui:Module]
# @RELATION: BELONGS_TO -> SrcRoot
# #region TestCleanReleaseTui [C:2] [TYPE Module]
# @RELATION BINDS_TO -> SrcRoot
# @SEMANTICS: tests, tui, clean-release, curses
# @PURPOSE: Unit tests for the interactive curses TUI of the clean release process.
# @LAYER: Scripts
# @LAYER Tests
# @INVARIANT: TUI initializes, handles hotkeys (F5, F10) and safely falls back without TTY.
import curses
@@ -25,8 +25,8 @@ def mock_stdscr() -> MagicMock:
return stdscr
# [DEF:test_headless_fallback:Function]
# @RELATION: BINDS_TO -> TestCleanReleaseTui
# #region test_headless_fallback [C:2] [TYPE Function]
# @RELATION BINDS_TO -> TestCleanReleaseTui
def test_headless_fallback(capsys):
"""
@TEST_EDGE: stdout_unavailable
@@ -44,11 +44,11 @@ def test_headless_fallback(capsys):
assert "Use CLI/API workflow instead" in captured.err
# [/DEF:test_headless_fallback:Function]
# #endregion test_headless_fallback
@patch("src.scripts.clean_release_tui.curses")
# [DEF:test_tui_initial_render:Function]
# @RELATION: BINDS_TO -> TestCleanReleaseTui
# #region test_tui_initial_render [C:2] [TYPE 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
@@ -81,11 +81,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]
# #endregion test_tui_initial_render
@patch("src.scripts.clean_release_tui.curses")
# [DEF:test_tui_run_checks_f5:Function]
# @RELATION: BINDS_TO -> TestCleanReleaseTui
# #region test_tui_run_checks_f5 [C:2] [TYPE 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.
@@ -120,11 +120,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]
# #endregion test_tui_run_checks_f5
@patch("src.scripts.clean_release_tui.curses")
# [DEF:test_tui_exit_f10:Function]
# @RELATION: BINDS_TO -> TestCleanReleaseTui
# #region test_tui_exit_f10 [C:2] [TYPE 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.
@@ -141,11 +141,11 @@ def test_tui_exit_f10(mock_curses_module, mock_stdscr: MagicMock):
assert app.status == "READY"
# [/DEF:test_tui_exit_f10:Function]
# #endregion test_tui_exit_f10
@patch("src.scripts.clean_release_tui.curses")
# [DEF:test_tui_clear_history_f7:Function]
# @RELATION: BINDS_TO -> TestCleanReleaseTui
# #region test_tui_clear_history_f7 [C:2] [TYPE Function]
# @RELATION BINDS_TO -> TestCleanReleaseTui
def test_tui_clear_history_f7(mock_curses_module, mock_stdscr: MagicMock):
"""
Simulates pressing F7 to clear history.
@@ -169,16 +169,16 @@ 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]
# #endregion test_tui_clear_history_f7
@patch("src.scripts.clean_release_tui.curses")
# [DEF:test_tui_real_mode_bootstrap_imports_artifacts_catalog:Function]
# @RELATION: BINDS_TO -> TestCleanReleaseTui
# #region test_tui_real_mode_bootstrap_imports_artifacts_catalog [C:2] [TYPE 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]
# #endregion test_tui_real_mode_bootstrap_imports_artifacts_catalog
):
"""
@@ -242,4 +242,4 @@ def test_tui_real_mode_bootstrap_imports_artifacts_catalog(
assert artifacts[0].detected_category == "core"
# [/DEF:TestCleanReleaseTui:Module]
# #endregion TestCleanReleaseTui