feat(clean-release): complete compliance redesign phases and polish tasks T047-T052
This commit is contained in:
@@ -29,25 +29,18 @@ def mock_stdscr() -> MagicMock:
|
||||
def test_headless_fallback(capsys):
|
||||
"""
|
||||
@TEST_EDGE: stdout_unavailable
|
||||
Tests that if the stream is not a TTY or PYTEST_CURRENT_TEST is set,
|
||||
the script falls back to a simple stdout print instead of trapping in curses.wrapper.
|
||||
Tests that non-TTY startup is explicitly refused and wrapper is not invoked.
|
||||
"""
|
||||
# Environment should trigger headless fallback due to PYTEST_CURRENT_TEST being set
|
||||
|
||||
with mock.patch("backend.src.scripts.clean_release_tui.curses.wrapper") as curses_wrapper_mock:
|
||||
with mock.patch("sys.stdout.isatty", return_value=False):
|
||||
exit_code = main()
|
||||
|
||||
# Ensures wrapper wasn't used
|
||||
|
||||
curses_wrapper_mock.assert_not_called()
|
||||
|
||||
# Verify it still exits 0
|
||||
assert exit_code == 0
|
||||
|
||||
# Verify headless info is printed
|
||||
|
||||
assert exit_code == 2
|
||||
captured = capsys.readouterr()
|
||||
assert "Enterprise Clean Release Validator (Headless Mode)" in captured.out
|
||||
assert "FINAL STATUS: READY" in captured.out
|
||||
assert "TTY is required for TUI mode" in captured.err
|
||||
assert "Use CLI/API workflow instead" in captured.err
|
||||
|
||||
|
||||
@patch("backend.src.scripts.clean_release_tui.curses")
|
||||
|
||||
Reference in New Issue
Block a user