Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

Studio: assert the argv, not the call count, in the shutdown spawn-refusal test (#10645)

Daniel Han532485e2c950
diff --git a/studio/backend/tests/test_llama_cpp_wait_for_health.py b/studio/backend/tests/test_llama_cpp_wait_for_health.py
index e45972d1962..e696f8187cb 100644
--- a/studio/backend/tests/test_llama_cpp_wait_for_health.py
+++ b/studio/backend/tests/test_llama_cpp_wait_for_health.py
@@ -250,9 +250,13 @@ class TestWaitForHealthResilience:
b = _make_backend()
b._shutting_down = True
spawned = []
- monkeypatch.setattr(subprocess, "Popen", lambda *a, **kw: spawned.append(1))
+ monkeypatch.setattr(subprocess, "Popen", lambda cmd = None, *a, **kw: spawned.append(cmd))
assert b._start_llama_process(["llama-server"], {}, child_gpu_physical_ids = None) is False
- assert spawned == [], "started a server after shutdown had begun"
+ # The argv, not the call count. The defensive kill at the top of
+ # _start_llama_process scans for descendants, and on macOS that scan shells out
+ # to `ps` through this same subprocess.Popen, so "nothing was spawned at all"
+ # fails there for a reason that has nothing to do with the spawn under test.
+ assert ["llama-server"] not in spawned, "started a server after shutdown had begun"
def test_a_teardown_with_no_process_still_marks_shutdown(self):
"""Quitting during a download or staging has nothing to kill, so