Skip to content

Commit b489e31

Browse files
test(dashboard): strengthen aiui failure assertion
Agent-Logs-Url: https://github.com/MervinPraison/PraisonAI/sessions/3693a252-dbc9-4237-b0ac-011ef90fa368 Co-authored-by: MervinPraison <454862+MervinPraison@users.noreply.github.com>
1 parent fc214ce commit b489e31

1 file changed

Lines changed: 11 additions & 8 deletions

File tree

src/praisonai/tests/unit/cli/test_dashboard_command.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,14 @@ def test_run_aiui_dashboard_returns_false_when_aiui_missing():
2626
def test_run_aiui_dashboard_returns_false_on_subprocess_failure():
2727
"""Should fail gracefully when aiui subprocess exits non-zero."""
2828
console = Console()
29-
with patch(
30-
"subprocess.run",
31-
side_effect=[
32-
MagicMock(returncode=0),
33-
subprocess.CalledProcessError(1, ["python", "temp_script.py"]),
34-
],
35-
):
36-
assert _run_aiui_dashboard(3000, "127.0.0.1", console) is False
29+
with patch.object(console, "print") as mock_print:
30+
with patch(
31+
"subprocess.run",
32+
side_effect=[
33+
MagicMock(returncode=0),
34+
subprocess.CalledProcessError(1, ["python", "temp_script.py"]),
35+
],
36+
):
37+
assert _run_aiui_dashboard(3000, "127.0.0.1", console) is False
38+
printed_messages = [call.args[0] for call in mock_print.call_args_list if call.args]
39+
assert any("exited with code 1" in message for message in printed_messages)

0 commit comments

Comments
 (0)