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: unblock three stale assertions broken on main (MLX CI + Backend CI) (#5803)

Daniel Han02ea6c9233c8
diff --git a/studio/backend/tests/test_desktop_auth.py b/studio/backend/tests/test_desktop_auth.py
index ab1a03eeda6..bc8788fd906 100644
--- a/studio/backend/tests/test_desktop_auth.py
+++ b/studio/backend/tests/test_desktop_auth.py
@@ -484,11 +484,14 @@ from typer.testing import CliRunner
studio_home = Path(sys.argv[1])
real_import = builtins.__import__
-def guarded_import(name, *args, **kwargs):
+def guarded_import(name, globals = None, locals = None, fromlist = (), level = 0):
+ # Only gate absolute imports; relative `from .utils import x` inside
+ # third-party packages (e.g. typer._click.decorators) hits level > 0
+ # with name="utils" and must pass through.
blocked = ("auth", "fastapi", "structlog", "utils")
- if name in blocked or name.startswith(("auth.", "utils.")):
+ if level == 0 and (name in blocked or name.startswith(("auth.", "utils."))):
raise ModuleNotFoundError(name)
- return real_import(name, *args, **kwargs)
+ return real_import(name, globals, locals, fromlist, level)
builtins.__import__ = guarded_import
from unsloth_cli.commands import studio as studio_cli
diff --git a/tests/studio/run_real_mlx_smoke.py b/tests/studio/run_real_mlx_smoke.py
index 27f682ee4ec..dc3001fd991 100644
--- a/tests/studio/run_real_mlx_smoke.py
+++ b/tests/studio/run_real_mlx_smoke.py
@@ -390,7 +390,11 @@ def cmd_train(args) -> int:
)
if k in train_result
}
- assert len(losses_per_step) == 7, f"expected 7 logged steps, got {losses_per_step}"
+ # logging_steps=1 + max_steps=N -> N callbacks; track config so the
+ # gate auto-follows if max_steps is bumped again.
+ assert (
+ len(losses_per_step) == config.max_steps
+ ), f"expected {config.max_steps} logged steps, got {losses_per_step}"
for i, l in enumerate(losses_per_step):
# Allow exact 0.0: fp16 per-step loss underflows to 0.0 after
# the LoRA reaches loss=0 around step ~10 with this fixture +