Skip to content

The agent that grows with you

test(desktop): neutralize the Linux password-store D-Bus probe in the Ctrl-C exit test

Hermes Agente2b1c6679192
diff --git a/tests/hermes_cli/test_gui_command.py b/tests/hermes_cli/test_gui_command.py
index 17f29e5ea79..5539631ae09 100644
--- a/tests/hermes_cli/test_gui_command.py
+++ b/tests/hermes_cli/test_gui_command.py
@@ -1126,12 +1126,15 @@ def test_gui_foreground_launch_ctrl_c_exits_cleanly(tmp_path, monkeypatch, capsy
root = _make_desktop_tree(tmp_path)
monkeypatch.setattr(cli_main, "PROJECT_ROOT", root)
# Patching hermes_cli.main.subprocess.run swaps the shared stdlib module's
- # attribute, so EVERY subprocess.run in the process raises. Two best-effort
- # pre-launch paths call it BEFORE the attached launch — outside the
- # KeyboardInterrupt handler under test — so neutralize both the way the
- # other foreground tests do: the Linux desktop-entry install (its
- # refresh_desktop_databases probe) and the sandbox fixup's `unshare`
- # user-namespace probe.
+ # attribute, so EVERY subprocess.run in the process raises. Three
+ # best-effort pre-launch paths call it BEFORE the attached launch — outside
+ # the KeyboardInterrupt handler under test — so neutralize each the way the
+ # other foreground tests do: the Linux password-store detection (its
+ # org.freedesktop.secrets D-Bus ping — contextlib.suppress(Exception)
+ # cannot swallow the KeyboardInterrupt, which then aborts the whole pytest
+ # session), the Linux desktop-entry install (its refresh_desktop_databases
+ # probe) and the sandbox fixup's `unshare` user-namespace probe.
+ monkeypatch.setattr(main_desktop, "_detect_linux_password_store", lambda: None)
monkeypatch.setattr(main_desktop, "_register_linux_desktop_entry", lambda **kw: None)
monkeypatch.setattr(main_desktop, "_desktop_linux_userns_sandbox_available", lambda: True)
packaged_exe = _make_packaged_executable(root, monkeypatch)