fix(mcp): use module-level time so test patches do not race background sleepers
This commit is contained in:
@@ -135,7 +135,7 @@ class TestStdioPidTracking:
|
||||
# bpo-14484). Return True so the SIGKILL escalation fires.
|
||||
with patch("tools.mcp_tool.os.kill") as mock_kill, \
|
||||
patch("gateway.status._pid_exists", return_value=True), \
|
||||
patch("time.sleep") as mock_sleep:
|
||||
patch("tools.mcp_tool.time.sleep") as mock_sleep:
|
||||
_kill_orphaned_mcp_children()
|
||||
|
||||
# SIGTERM then SIGKILL; the alive check no longer touches os.kill.
|
||||
@@ -163,7 +163,7 @@ class TestStdioPidTracking:
|
||||
monkeypatch.delattr(signal, "SIGKILL", raising=False)
|
||||
|
||||
with patch("tools.mcp_tool.os.kill") as mock_kill, \
|
||||
patch("time.sleep") as mock_sleep:
|
||||
patch("tools.mcp_tool.time.sleep") as mock_sleep:
|
||||
_kill_orphaned_mcp_children()
|
||||
|
||||
# SIGTERM phase, alive check raises (process gone), no escalation
|
||||
|
||||
Reference in New Issue
Block a user