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.

Tests: catch up with four product changes that landed red on main (#13445)

Daniel Han496a81619406
diff --git a/studio/backend/tests/test_diffusion_mlx_engine_router.py b/studio/backend/tests/test_diffusion_mlx_engine_router.py
index 0e6258bfe25..bfb8b494f90 100644
--- a/studio/backend/tests/test_diffusion_mlx_engine_router.py
+++ b/studio/backend/tests/test_diffusion_mlx_engine_router.py
@@ -409,7 +409,9 @@ def test_runtime_requirements_match_the_installer():
from core.inference.mlx_diffusion_convert import MFLUX_VERSION
- source = (Path(__file__).resolve().parents[2] / "install_python_stack.py").read_text()
+ source = (Path(__file__).resolve().parents[2] / "install_python_stack.py").read_text(
+ encoding = "utf-8"
+ )
literals = {
node.targets[0].id if isinstance(node, ast.Assign) else node.target.id: node.value
for node in ast.parse(source).body
diff --git a/tests/studio/install/test_windows_torch_flavor_invariant.py b/tests/studio/install/test_windows_torch_flavor_invariant.py
index a9e6a51e707..ef3ae6e732f 100644
--- a/tests/studio/install/test_windows_torch_flavor_invariant.py
+++ b/tests/studio/install/test_windows_torch_flavor_invariant.py
@@ -290,12 +290,13 @@ class TestStepThirteenWiring:
assert calls[:2] == ["_progress", "_torch_step_label"]
# str() coerces the probe label and does not represent a step.
step13 = [c for c in _calls_in(guards[1]) if c != "str"]
- # repairs refresh torchao and flash-attn for final torch (#13244), then evict incompatible xFormers (#11545).
+ # repairs refresh torchao and flash-attn for final torch (#13244), then causal-conv1d and
+ # mamba-ssm (#13396), then evict incompatible xFormers (#11545).
assert step13 == (
["_progress", "_torch_step_label", "_probe_installed_torch_version"]
+ repairs
+ ["_probe_installed_torch_version", "_note", "_install_torchao_for_torch"]
- + ["_ensure_flash_attn"]
+ + ["_ensure_flash_attn", "_ensure_ssm_kernels"]
+ ["_evict_xformers_built_for_another_torch", "_evict_xformers_requiring_another_torch"]
), step13
assert "_install_torchao_for_torch" not in _calls_in(guards[0])
@@ -329,13 +330,14 @@ class TestStepTotals:
# Both carry the Windows-only accelerate repair (8c), which ignores NO_TORCH; the
# no-torch case also gets the runtime-deps slot an update announces separately. Both also
# carry the diffusers main slot (11c), which is spent on every path including opting out.
- assert _base_total(IS_WINDOWS = True) == 18
+ # With torch, the causal-conv1d + mamba-ssm slot (#13396) sits under flash-attn's gate.
+ assert _base_total(IS_WINDOWS = True) == 19
assert _base_total(IS_WINDOWS = True, NO_TORCH = True) == 16
@pytest.mark.parametrize(
"flags,total",
[
- ({}, 18), # Linux, torch
+ ({}, 19), # Linux, torch (incl. the causal-conv1d + mamba-ssm slot)
({"NO_TORCH": True}, 16), # Linux, GGUF-only (incl. the no-torch runtime step)
# Two MLX slots: the install step and the post-core-phase re-resolve. Plus the MLX
# grammar engine (11d), which every Apple Silicon run spends, with torch or without.
diff --git a/tests/studio/test_token_count_prompt_parity.py b/tests/studio/test_token_count_prompt_parity.py
index 19ad1358069..a3d2eb453c5 100644
--- a/tests/studio/test_token_count_prompt_parity.py
+++ b/tests/studio/test_token_count_prompt_parity.py
@@ -116,9 +116,13 @@ const state: any = {
reasoningEffortLevels: ["low", "medium", "high"],
supportsPreserveThinking: false,
preserveThinking: false,
+ // The browser panel's agent store (#13372): off by default, as in agent-store.ts. The count
+ // and the request both call browserAgentToolsForTurn(), so parity holds either way.
+ browserAgent: { enabled: false, historyAccess: "ask" },
};
const useChatRuntimeStore: any = { getState: () => state };
+const useBrowserAgentStore: any = { getState: () => state.browserAgent };
export function seed(patch: any): void {
Object.assign(state, patch);
diff --git a/tests/test_return_logits_survives_for_training.py b/tests/test_return_logits_survives_for_training.py
index efb004ec0c8..e964c906f12 100644
--- a/tests/test_return_logits_survives_for_training.py
+++ b/tests/test_return_logits_survives_for_training.py
@@ -28,6 +28,16 @@ class _Namespace(dict):
return getattr(builtins, name, None)
+class _StrictNamespace(dict):
+ # for_training has no optional globals: a helper it gained and the stubs below lack must
+ # fail as a NameError naming it, not as "'NoneType' object is not callable" (#13374).
+ def __missing__(self, name):
+ try:
+ return getattr(builtins, name)
+ except AttributeError:
+ raise NameError(f"for_training uses {name!r}: stub it below") from None
+
+
def _torch_or_stub():
"""The fakes here are not nn.Modules, so without torch the lifted code takes its non-Module path."""
try:
@@ -141,10 +151,12 @@ def _fast_llama_for_training():
cls = next(n for n in tree.body if isinstance(n, ast.ClassDef) and n.name == "FastLlamaModel")
fn = next(n for n in cls.body if isinstance(n, ast.FunctionDef) and n.name == "for_training")
fn.decorator_list = []
- namespace = _Namespace(
+ namespace = _StrictNamespace(
os = os,
- resolve_training_gradient_checkpointing = lambda model, flag: False,
- arm_gradient_checkpointing = lambda model: None,
+ # for_training's helpers since #13374: one walk returns (checkpointing modules, apply).
+ switch_training_mode = lambda model, training, defer = False: ([], lambda: None),
+ resolve_training_gradient_checkpointing = lambda model, flag, checkpointing = None: False,
+ arm_gradient_checkpointing = lambda model, checkpointing = None: False,
set_module_gradient_checkpointing = lambda module, flag: None,
)
module = ast.fix_missing_locations(ast.Module(body = [fn], type_ignores = []))