Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

test: count a zombie grandchild as killed in the fake prisma cli

mateofdd6f6021642
diff --git a/tests/test_litellm/proxy/db/conftest.py b/tests/test_litellm/proxy/db/conftest.py
index d3226b0ec50..bcb7794a20d 100644
--- a/tests/test_litellm/proxy/db/conftest.py
+++ b/tests/test_litellm/proxy/db/conftest.py
@@ -35,6 +35,14 @@ DB_ENV_KEYS = (
_db_env_snapshot_key = pytest.StashKey[dict[str, Optional[str]]]()
+def _is_zombie(pid: int) -> bool:
+ try:
+ stat: Final = Path(f"/proc/{pid}/stat").read_text()
+ except OSError:
+ return False
+ return stat.rpartition(")")[2].split()[0] == "Z"
+
+
def _db_env_snapshot() -> dict[str, Optional[str]]:
return {key: os.environ.get(key) for key in DB_ENV_KEYS}
@@ -136,6 +144,8 @@ class FakePrismaCli:
os.kill(pid, 0)
except ProcessLookupError:
return True
+ if _is_zombie(pid):
+ return True
time.sleep(0.05)
return False