mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-31 19:16:29 +00:00
test(cli): mock _cleanup_oneshot_runtime in all _run_and_exit tests
Phase 2c found 3 tests that called _run_and_exit_oneshot without mocking _cleanup_oneshot_runtime, causing real cleanup (terminal, browser, MCP, auxiliary) to run in the pytest worker. Add the mock to all three for test isolation. Also remove redundant 'import logging' inside _exit_after_oneshot (already imported at module level, line 729).
This commit is contained in:
parent
97fc8a4a3c
commit
244dabbd9c
2 changed files with 3 additions and 1 deletions
|
|
@ -82,7 +82,6 @@ def _exit_after_oneshot(rc: object) -> None:
|
|||
except Exception:
|
||||
pass
|
||||
try:
|
||||
import logging
|
||||
logging.shutdown()
|
||||
except Exception:
|
||||
pass
|
||||
|
|
|
|||
|
|
@ -805,6 +805,7 @@ def test_run_and_exit_oneshot_routes_system_exit_to_hard_exit(monkeypatch, main_
|
|||
"hermes_cli.oneshot",
|
||||
types.SimpleNamespace(run_oneshot=fake_run_oneshot),
|
||||
)
|
||||
monkeypatch.setattr(main_mod, "_cleanup_oneshot_runtime", lambda: None)
|
||||
monkeypatch.setattr(main_mod, "_exit_after_oneshot", lambda rc: exits.append(rc))
|
||||
|
||||
main_mod._run_and_exit_oneshot("hello")
|
||||
|
|
@ -844,6 +845,7 @@ def test_run_and_exit_oneshot_prints_system_exit_message(
|
|||
"hermes_cli.oneshot",
|
||||
types.SimpleNamespace(run_oneshot=fake_run_oneshot),
|
||||
)
|
||||
monkeypatch.setattr(main_mod, "_cleanup_oneshot_runtime", lambda: None)
|
||||
monkeypatch.setattr(main_mod, "_exit_after_oneshot", lambda rc: exits.append(rc))
|
||||
|
||||
main_mod._run_and_exit_oneshot("hello")
|
||||
|
|
@ -986,6 +988,7 @@ def test_run_and_exit_oneshot_routes_keyboard_interrupt_to_130(
|
|||
"hermes_cli.oneshot",
|
||||
types.SimpleNamespace(run_oneshot=fake_run_oneshot),
|
||||
)
|
||||
monkeypatch.setattr(main_mod, "_cleanup_oneshot_runtime", lambda: None)
|
||||
monkeypatch.setattr(main_mod, "_exit_after_oneshot", lambda rc: exits.append(rc))
|
||||
|
||||
main_mod._run_and_exit_oneshot("hello")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue