Skip to content

The agent that grows with you

test: LSP hard-kill test no longer races its own cleanup

Teknium1f2b9e08644c
diff --git a/tests/agent/lsp/test_client_e2e.py b/tests/agent/lsp/test_client_e2e.py
index fa008816c5c..e198b60eeaf 100644
--- a/tests/agent/lsp/test_client_e2e.py
+++ b/tests/agent/lsp/test_client_e2e.py
@@ -8,6 +8,7 @@ pyright/gopls/etc. to be installed in CI.
from __future__ import annotations
import asyncio
+import contextlib
import os
import sys
from pathlib import Path
@@ -185,8 +186,10 @@ async def test_cancelled_start_hard_kills_sigterm_ignoring_descendant(tmp_path:
if not start.done():
start.cancel()
await asyncio.gather(start, return_exceptions=True)
- if child is not None and child.is_running():
- child.kill()
+ if child is not None:
+ # The descendant can exit between a liveness check and the signal; killing a gone process is fine.
+ with contextlib.suppress(psutil.NoSuchProcess):
+ child.kill()
@pytest.mark.asyncio