From 7ccfb97feeac4e58d1404edc73fc0d211b43490d Mon Sep 17 00:00:00 2001 From: Brooklyn Nicholson Date: Sun, 26 Apr 2026 22:57:58 -0500 Subject: [PATCH] test(cli): assert active-session file lifecycle in launch_tui Validate that the temp active-session file exists while the TUI subprocess runs and is removed after launch cleanup to match mkstemp semantics. --- tests/hermes_cli/test_tui_resume_flow.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/hermes_cli/test_tui_resume_flow.py b/tests/hermes_cli/test_tui_resume_flow.py index aa1459bc1e..2449893103 100644 --- a/tests/hermes_cli/test_tui_resume_flow.py +++ b/tests/hermes_cli/test_tui_resume_flow.py @@ -124,6 +124,7 @@ def test_cmd_chat_tui_passes_model_and_provider(monkeypatch, main_mod): def test_launch_tui_exports_model_and_provider(monkeypatch, main_mod): captured = {} + active_path_during_call = None monkeypatch.setattr( main_mod, @@ -132,7 +133,10 @@ def test_launch_tui_exports_model_and_provider(monkeypatch, main_mod): ) def fake_call(argv, cwd=None, env=None): + nonlocal active_path_during_call captured.update({"argv": argv, "cwd": cwd, "env": env}) + active_path_during_call = Path(env["HERMES_TUI_ACTIVE_SESSION_FILE"]) + assert active_path_during_call.exists() return 1 monkeypatch.setattr(main_mod.subprocess, "call", fake_call) @@ -148,6 +152,7 @@ def test_launch_tui_exports_model_and_provider(monkeypatch, main_mod): active_path = Path(env["HERMES_TUI_ACTIVE_SESSION_FILE"]) assert active_path.name.startswith("hermes-tui-active-session-") assert active_path.suffix == ".json" + assert active_path_during_call == active_path assert not active_path.exists() assert env["NODE_ENV"] == "production"