18 lines
689 B
Python
18 lines
689 B
Python
"""Regression tests for Desktop-owned ``hermes serve`` lifecycle tracking."""
|
|
|
|
from hermes_cli.web_server import _is_serve_orphaned
|
|
|
|
|
|
def test_parent_watchdog_tracks_recorded_desktop_pid_not_immediate_ppid():
|
|
"""Windows venv launch shims must not make a live Desktop look orphaned."""
|
|
|
|
assert _is_serve_orphaned(4242, pid_exists=lambda pid: pid == 4242) is False
|
|
assert _is_serve_orphaned(4242, pid_exists=lambda _pid: False) is True
|
|
|
|
|
|
def test_parent_watchdog_fails_safe_when_liveness_probe_errors():
|
|
def broken_probe(_pid: int) -> bool:
|
|
raise OSError("process table temporarily unavailable")
|
|
|
|
assert _is_serve_orphaned(4242, pid_exists=broken_probe) is False
|