From e744fb75ededc9ef0e82202e47820240e1178b1a Mon Sep 17 00:00:00 2001 From: Daniel Han Date: Thu, 18 Jun 2026 22:52:21 -0700 Subject: [PATCH] test(studio): stop llama.cpp update worker tests hanging on a fully-installed host _run_update imports routes.inference.get_llama_cpp_backend, which on a fully-installed host pulls a real Studio singleton and blocks on its load lock. Default the autouse fixture to a no-backend stub (the fail-open path); the load-coordination tests still inject their own backend over it. --- studio/backend/tests/test_llama_cpp_update.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/studio/backend/tests/test_llama_cpp_update.py b/studio/backend/tests/test_llama_cpp_update.py index 326b3dc6aa..3755756158 100644 --- a/studio/backend/tests/test_llama_cpp_update.py +++ b/studio/backend/tests/test_llama_cpp_update.py @@ -121,6 +121,21 @@ def _clean_state(monkeypatch, tmp_path): monkeypatch.delenv("UNSLOTH_LLAMA_CPP_PATH", raising = False) # Never hit the network in these tests. monkeypatch.setattr(freshness, "_fetch_latest_release_tag", lambda repo, timeout = 5.0: None) + # Default to no live inference backend: on a fully-installed host + # `from routes.inference import get_llama_cpp_backend` (inside _run_update) + # imports a real Studio singleton and blocks on its load lock, making the + # worker tests hang/flake by host. This is the CI/fail-open path; the + # load-coordination tests inject their own backend over this default. + _routes_pkg = ModuleType("routes") + _routes_pkg.__path__ = [] + _inference_mod = ModuleType("routes.inference") + + def _no_backend_in_tests(): + raise RuntimeError("no inference backend in unit tests") + + _inference_mod.get_llama_cpp_backend = _no_backend_in_tests + monkeypatch.setitem(sys.modules, "routes", _routes_pkg) + monkeypatch.setitem(sys.modules, "routes.inference", _inference_mod) yield freshness.reset_caches() upd._reset_job_for_tests()