mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-18 04:41:56 +00:00
test(gateway): patch _pid_exists instead of os.kill for scoped-lock tests
Post-#21561 the liveness probe in acquire_scoped_lock() routes through gateway.status._pid_exists (psutil-first, safe on Windows), not os.kill(pid, 0). The two new macOS regression tests were patching status.os.kill, which had no effect — the unmocked psutil call returned False for PID 99999, marking the lock stale before the new code branch ran. The 'replaces' test passed only because acquired=True was already the expected outcome; the 'keeps' test failed in CI. Switch both tests to monkeypatch status._pid_exists directly, matching the existing test_acquire_scoped_lock_rejects_live_other_process pattern, so they actually exercise the new start_time=None + cmdline-based staleness branch.
This commit is contained in:
parent
653d304290
commit
629c33c633
1 changed files with 5 additions and 2 deletions
|
|
@ -462,7 +462,10 @@ class TestScopedLocks:
|
|||
"argv": ["/Users/user/.hermes/hermes-agent/hermes_cli/main.py", "gateway", "run", "--replace"],
|
||||
}))
|
||||
|
||||
monkeypatch.setattr(status.os, "kill", lambda pid, sig: None)
|
||||
# Post-#21561 the liveness probe routes through
|
||||
# ``gateway.status._pid_exists`` (psutil-first, safe on Windows),
|
||||
# not ``os.kill``.
|
||||
monkeypatch.setattr(status, "_pid_exists", lambda pid: True)
|
||||
monkeypatch.setattr(status, "_get_process_start_time", lambda pid: None)
|
||||
monkeypatch.setattr(status, "_looks_like_gateway_process", lambda pid: False)
|
||||
|
||||
|
|
@ -485,7 +488,7 @@ class TestScopedLocks:
|
|||
"argv": ["/Users/user/.hermes/hermes-agent/hermes_cli/main.py", "gateway", "run", "--replace"],
|
||||
}))
|
||||
|
||||
monkeypatch.setattr(status.os, "kill", lambda pid, sig: None)
|
||||
monkeypatch.setattr(status, "_pid_exists", lambda pid: True)
|
||||
monkeypatch.setattr(status, "_get_process_start_time", lambda pid: None)
|
||||
monkeypatch.setattr(status, "_looks_like_gateway_process", lambda pid: True)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue