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.

Bring two diffusion route test fakes up to the load id routes (#15090)

Daniel Han630996c346e5
diff --git a/studio/backend/tests/test_cache_inventory_path_boundary.py b/studio/backend/tests/test_cache_inventory_path_boundary.py
index 1e4ca204cc8..65b78b2728b 100644
--- a/studio/backend/tests/test_cache_inventory_path_boundary.py
+++ b/studio/backend/tests/test_cache_inventory_path_boundary.py
@@ -1263,9 +1263,12 @@ def test_a_second_load_does_not_hand_back_the_resident_path(monkeypatch):
**{"loaded": True, "repo_id": resident, "model_path": resident}
)
- class _Request:
- model_path = "ref:whatever"
- base_repo = None
+ # The real request model, unvalidated: every field the route reads keeps its default
+ # (load_token, expected_load_id, ...), so a field the route starts reading cannot break this.
+ from models.inference import DiffusionLoadRequest
+
+ def _Request():
+ return DiffusionLoadRequest.model_construct(model_path = "ref:whatever", base_repo = None)
monkeypatch.setattr(inference_routes, "load_diffusion_model_gated", _gated)
diff --git a/studio/backend/tests/test_diffusion_static_skip.py b/studio/backend/tests/test_diffusion_static_skip.py
index e2af70f7e38..9a8329c44d8 100644
--- a/studio/backend/tests/test_diffusion_static_skip.py
+++ b/studio/backend/tests/test_diffusion_static_skip.py
@@ -926,14 +926,11 @@ def test_status_route_shows_skip_counts_only_to_their_producer(monkeypatch, scop
"planned_skips": 9,
"stats": {"calls": 25, "computed": 16, "skipped": 9},
}
- monkeypatch.setattr(
- diffusion_engine_router,
- "active_status",
- lambda: {"loaded": True, "transformer_cache": "static", "transformer_cache_stats": stats},
- )
- # The caller gets the view's snapshot, not the earlier status() read.
+ status = {"loaded": True, "transformer_cache": "static", "transformer_cache_stats": stats}
+ # The caller gets the view's snapshot, not the earlier status() read. The route reads the
+ # engine's own status() (paired with its load id), so the fake engine answers it.
fresh = {**stats, "stats": {"calls": 30, "computed": 19, "skipped": 11}}
- engine = types.SimpleNamespace(static_skip_view = lambda: (owner, fresh))
+ engine = types.SimpleNamespace(status = lambda: status, static_skip_view = lambda: (owner, fresh))
monkeypatch.setattr(diffusion_engine_router, "get_active_diffusion_engine", lambda: engine)
monkeypatch.setattr(account_access, "resident_hidden", lambda *a, **k: False)
monkeypatch.setattr(account_access, "account_scope", lambda: scope)