Skip to content

~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.

test(close_base_llm): warm up FD-growth tests to absorb init drift (#4214)

LearningCircuit75a54357ad8f
diff --git a/tests/utilities/test_close_base_llm.py b/tests/utilities/test_close_base_llm.py
index 7e56824abf..40158e5a9a 100644
--- a/tests/utilities/test_close_base_llm.py
+++ b/tests/utilities/test_close_base_llm.py
@@ -373,10 +373,7 @@ class TestCloseBaseLLMRealHttpxAsync:
async def _make():
return httpx.AsyncClient()
- gc.collect()
- before = _open_fd_count()
-
- for _ in range(5):
+ def _one_cycle():
async_httpx = asyncio.run(_make())
async_ollama = type("FakeAsyncOllama", (), {})()
async_ollama._client = async_httpx
@@ -388,6 +385,18 @@ class TestCloseBaseLLMRealHttpxAsync:
_close_base_llm(llm)
del llm, async_ollama, async_httpx
+
+ # Warmup: one cycle before measuring absorbs one-time init drift
+ # (lazy imports, logging handlers, asyncio internals first-init)
+ # that would otherwise eat the +2 steady-state slack. A real
+ # per-iteration leak still shows as ≥+5 across the 5 measured iters.
+ _one_cycle()
+ gc.collect()
+
+ before = _open_fd_count()
+
+ for _ in range(5):
+ _one_cycle()
gc.collect()
gc.collect()
@@ -425,7 +434,11 @@ class TestCloseBaseLLMRealHttpxAsync:
assert async_httpx.is_closed is True
+ # Warmup cycle to absorb one-time init drift (cleanup-thread
+ # startup, lazy imports) — see the sibling repeated-close test.
+ asyncio.run(_close_from_inside_loop())
gc.collect()
+
before = _open_fd_count()
for _ in range(5):