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.

Pin the hardware verdict in the two export capability tests that depend on it (#11490)

Daniel Han259a506a0ac1
diff --git a/studio/backend/tests/test_export_capability.py b/studio/backend/tests/test_export_capability.py
index 06ab76b5647..bb90de94126 100644
--- a/studio/backend/tests/test_export_capability.py
+++ b/studio/backend/tests/test_export_capability.py
@@ -43,6 +43,14 @@ def _patch(monkeypatch, *, torch: bool, device, apple: bool):
def test_cpu_with_torch_unsupported_no_accelerator(monkeypatch):
# PyTorch present but no accelerator: unsupported with no_accelerator, not "PyTorch missing".
_patch(monkeypatch, torch = True, device = hw.DeviceType.CPU, apple = False)
+ # Both branches below sit AFTER the gpu-present-but-unusable one, so they are only
+ # reachable on a host with no accelerator at all. The verdict is module state that
+ # detection writes and that current_chat_only_verdict() re-derives from a 60 second
+ # inventory cache, so without pinning it here this reads whatever an earlier test in
+ # the same worker left behind: a run that has already faked an NVIDIA host answers
+ # "torch_cpu_build" and never reaches the branch being asserted. The rest of this file
+ # already pins the verdict wherever it matters.
+ monkeypatch.setattr(hw, "current_chat_only_verdict", lambda: ("no_gpu", None))
cap = hw.export_capability()
assert cap["export_supported"] is False
assert cap["export_unsupported_reason"] == "no_accelerator"
@@ -72,6 +80,14 @@ def test_mlx_without_torch_supports_export(monkeypatch):
def test_no_torch_non_apple_reports_pytorch_missing(monkeypatch):
_patch(monkeypatch, torch = False, device = hw.DeviceType.CPU, apple = False)
+ # Both branches below sit AFTER the gpu-present-but-unusable one, so they are only
+ # reachable on a host with no accelerator at all. The verdict is module state that
+ # detection writes and that current_chat_only_verdict() re-derives from a 60 second
+ # inventory cache, so without pinning it here this reads whatever an earlier test in
+ # the same worker left behind: a run that has already faked an NVIDIA host answers
+ # "torch_cpu_build" and never reaches the branch being asserted. The rest of this file
+ # already pins the verdict wherever it matters.
+ monkeypatch.setattr(hw, "current_chat_only_verdict", lambda: ("no_gpu", None))
cap = hw.export_capability()
assert cap["export_supported"] is False
assert cap["export_unsupported_reason"] == "pytorch_not_installed"