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.

Fix three tests red on main after #12431, #12408 and #12382 (#12441)

Daniel Hana33403825f5c
diff --git a/studio/backend/tests/test_diffusion_memory.py b/studio/backend/tests/test_diffusion_memory.py
index 721141fb3ab..9426a4efab7 100644
--- a/studio/backend/tests/test_diffusion_memory.py
+++ b/studio/backend/tests/test_diffusion_memory.py
@@ -2973,6 +2973,10 @@ def test_top_level_group_counts_against_the_running_pin_total(monkeypatch):
)
]
monkeypatch.setattr(mem, "_pin_budget_mib", lambda: 8)
+ # What is under test is the running-total accounting, not page locking: a plain host copy
+ # stands in for pin_memory, which raises on a host with no CUDA device (the CPU CI runners).
+ torch = pytest.importorskip("torch")
+ monkeypatch.setattr(torch.Tensor, "pin_memory", lambda self: self.clone())
# 8 MiB budget, 8 MiB of encoders already pinned: the 1 MiB top group no longer fits
assert mem._pin_top_level_group(module, None, [8]) is False
assert group.onload_ == "diffusers"
diff --git a/studio/backend/tests/test_video_chat_completions_behaviour.py b/studio/backend/tests/test_video_chat_completions_behaviour.py
index 9c1cb31e5ad..8b0ee439f22 100644
--- a/studio/backend/tests/test_video_chat_completions_behaviour.py
+++ b/studio/backend/tests/test_video_chat_completions_behaviour.py
@@ -18,6 +18,7 @@ from __future__ import annotations
from types import SimpleNamespace
+import re
import pytest
pytest.importorskip("torch")
@@ -180,7 +181,12 @@ def test_the_text_of_the_turn_survives_translation(monkeypatch):
backend = _VideoGguf()
with _client(monkeypatch, backend) as client:
client.post("/v1/chat/completions", json = _part_body(_DATA_URI, text = "what colour?"))
- assert {"type": "text", "text": "what colour?"} in _sent_parts(backend)
+ texts = [p["text"] for p in _sent_parts(backend) if p.get("type") == "text"]
+ # The only rewrite allowed is the date note #12382 puts at the head of a chat's first
+ # message when the date setting is on and there is no system prompt.
+ assert any(
+ re.fullmatch(r"(\[Current date: \d{4}-\d{2}-\d{2}\]\n\n)?what colour\?", t) for t in texts
+ ), texts
def test_every_clip_in_a_turn_is_translated(monkeypatch):
diff --git a/tests/studio/test_settings_compact_overflow_contract.py b/tests/studio/test_settings_compact_overflow_contract.py
index 7d147b31622..16463959b91 100644
--- a/tests/studio/test_settings_compact_overflow_contract.py
+++ b/tests/studio/test_settings_compact_overflow_contract.py
@@ -1,5 +1,6 @@
"""Responsive overflow contracts for the settings dialog."""
+import re
from pathlib import Path
@@ -34,7 +35,15 @@ def test_api_monitor_entries_and_expanded_text_can_shrink():
assert '"flex w-full min-w-0 flex-col gap-1 border-b border-border/50' in source
assert '<section className="flex min-w-0 flex-col gap-1.5">' in source
# Prompt and reply are unbounded user text: height-capped, scrollable, wrapped.
- assert "max-h-72 overflow-auto whitespace-pre-wrap break-words rounded-lg bg-muted/50" in source
+ # Read as tokens: #12431 added scroll-rounded to these boxes, which changes none of this.
+ text_boxes = [
+ set(literal.split())
+ for literal in re.findall(r'"([^"\n]*)"', source)
+ if {"whitespace-pre-wrap", "rounded-lg"} <= set(literal.split())
+ ]
+ assert text_boxes, "no wrapped, rounded text box in the API monitor"
+ for tokens in text_boxes:
+ assert {"max-h-72", "overflow-auto", "break-words"} <= tokens, sorted(tokens)
# A model id or path has no spaces to wrap on, so it needs break-all.
assert 'className="min-w-0 break-all font-mono' in source