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.

Stop the torchao ROCm test from depending on the host's GPU (#10099)

Daniel Han9954357d40a1
diff --git a/studio/backend/tests/test_mcp_training_start_guard.py b/studio/backend/tests/test_mcp_training_start_guard.py
index d18b4b90140..bd17777a3c6 100644
--- a/studio/backend/tests/test_mcp_training_start_guard.py
+++ b/studio/backend/tests/test_mcp_training_start_guard.py
@@ -351,8 +351,14 @@ def test_the_mcp_tool_surfaces_the_409_as_a_tool_error_not_a_dict(monkeypatch):
# The tool body raises rather than returning the {"status": ...} dict that
# stop_training / get_training_status return.
+ # Public fastmcp API only. The private equivalents (_get_tool/_call_tool_mcp)
+ # work too, but _call_tool_mcp was dropped in fastmcp 4.0.0 while the pin is an
+ # open ">=3.0.2", so a private call here breaks the suite on an upstream major
+ # that the product itself is unaffected by. get_tool/call_tool are present with
+ # these same signatures on both 3.0.2 (the floor) and 4.x.
async def run_tool_body():
- tool = await server._get_tool("start_training")
+ tool = await server.get_tool("start_training")
+ assert tool is not None, "start_training must be registered on the studio MCP server"
return await tool.fn(config = _config())
with pytest.raises(HTTPException) as excinfo:
@@ -368,7 +374,9 @@ def test_the_mcp_tool_surfaces_the_409_as_a_tool_error_not_a_dict(monkeypatch):
# mask_error_details defaults False, so the 409 detail survives to the client
# (as the text of an isError CallToolResult, not a JSON-RPC protocol error).
- assert server._mask_error_details is False
+ # Asserted through the surfaced message rather than the server's private
+ # _mask_error_details flag: the detail reaching the caller is the property that
+ # matters, and it stays true however that flag is spelled upstream.
assert "inference request is in progress" in str(tool_error.value)
assert "Error calling tool 'start_training'" in str(tool_error.value)
diff --git a/studio/backend/tests/test_torchao_select.py b/studio/backend/tests/test_torchao_select.py
index 38f84b18136..75466c2295e 100644
--- a/studio/backend/tests/test_torchao_select.py
+++ b/studio/backend/tests/test_torchao_select.py
@@ -100,6 +100,9 @@ def test_windows_first_hop_uses_einx_wheel_without_shared_test_tree():
[
(True, False),
(False, True),
+ # Both signals agree: the ordinary Windows ROCm host, and the case a
+ # two-mixed-only parametrization never covered.
+ (True, True),
],
)
def test_skips_torchao_on_windows_rocm(
@@ -145,7 +148,19 @@ def test_skips_torchao_on_windows_rocm(
monkeypatch.setattr(mod, "_repair_bad_anyio", lambda: None)
monkeypatch.setattr(mod, "_ensure_rocm_torch", lambda: None)
monkeypatch.setattr(mod, "_ensure_cuda_torch", lambda: None)
- monkeypatch.setattr(mod, "_has_usable_nvidia_gpu", lambda: True)
+ # A Windows ROCm box has no usable NVIDIA GPU. Claiming one here described a
+ # machine that cannot exist, and _expected_torch_flavor_tag reads exactly this
+ # flag to decide whether a CUDA expectation exists at all: with it True, the
+ # Windows flavor invariant demanded a cu* build, found the runner's CPU torch,
+ # and failed the whole install long after the torchao branch under test.
+ monkeypatch.setattr(mod, "_has_usable_nvidia_gpu", lambda: False)
+ # The installed torch is ambient, so leaving it unpatched made the verdict depend
+ # on the developer's machine: a CUDA workstation passed and a CPU-only CI runner
+ # failed, on identical code.
+ monkeypatch.setattr(mod, "_RECORDED_TORCH_TAG", "")
+ monkeypatch.setattr(
+ mod, "_probe_torch_runtime", lambda *args, **kwargs: (True, True, "2.9.1+cpu", "", "")
+ )
monkeypatch.setattr(mod, "run", lambda *args, **kwargs: None)
monkeypatch.setattr(mod, "pip_install", _record_pip_install)
monkeypatch.setattr(mod, "_progress", lambda label: progress_labels.append(label))
@@ -153,6 +168,15 @@ def test_skips_torchao_on_windows_rocm(
monkeypatch.setattr(mod, "LOCAL_DD_GITHUB_PLUGIN", github_plugin)
monkeypatch.setattr(mod.subprocess, "run", lambda *args, **kwargs: subprocess_result)
+ # Checked BEFORE the install so a regression names its cause here rather than as
+ # an opaque `assert 1 == 0` on the line below, which is how this surfaced: the run
+ # returned 1 on a CPU-only runner and 0 on a CUDA workstation, on identical code.
+ assert mod._expected_torch_flavor_tag() == "", (
+ "no CUDA expectation may exist on a Windows ROCm host: a non-empty tag means "
+ "the Windows flavor invariant will demand a cu* build, not find one, and fail "
+ "the install long after the torchao branch this test is about"
+ )
+
assert mod.install_python_stack() == 0
assert not any(spec.startswith("torchao") for spec in installed_specs)