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: name text encodings and gate CUDA skips on has_real_cuda (#14871)

Daniel Hanc2efedc690a8
diff --git a/studio/backend/tests/test_diffusion_vpred_sdxl_detect.py b/studio/backend/tests/test_diffusion_vpred_sdxl_detect.py
index 1ea9a0e7eaa..9ee3248d461 100644
--- a/studio/backend/tests/test_diffusion_vpred_sdxl_detect.py
+++ b/studio/backend/tests/test_diffusion_vpred_sdxl_detect.py
@@ -404,7 +404,9 @@ def test_a_cache_only_prefetch_never_touches_the_hub(hub_cache, monkeypatch):
def test_the_load_route_passes_user_initiated_to_the_prefetch():
import ast
- source = (Path(__file__).resolve().parents[1] / "routes" / "inference.py").read_text()
+ source = (Path(__file__).resolve().parents[1] / "routes" / "inference.py").read_text(
+ encoding = "utf-8"
+ )
tree = ast.parse(source)
route = next(
n
@@ -575,7 +577,7 @@ def test_the_load_passes_the_repo_to_the_pipeline_marker_check():
source = (
Path(__file__).resolve().parents[1] / "core" / "inference" / "diffusion.py"
- ).read_text()
+ ).read_text(encoding = "utf-8")
calls = [
c
for c in ast.walk(ast.parse(source))
@@ -661,7 +663,7 @@ def test_the_load_hands_the_uncollapsed_token_to_the_marker_probe():
source = (
Path(__file__).resolve().parents[1] / "core" / "inference" / "diffusion.py"
- ).read_text()
+ ).read_text(encoding = "utf-8")
tree = ast.parse(source)
methods = {
n.name: n
diff --git a/studio/backend/utils/lan_access_settings.py b/studio/backend/utils/lan_access_settings.py
index bc02b214c25..9930d41347e 100644
--- a/studio/backend/utils/lan_access_settings.py
+++ b/studio/backend/utils/lan_access_settings.py
@@ -406,7 +406,7 @@ def _veth_addresses(sysfs: str = "/sys/class/net") -> set[str]:
links to an index visible here, so host networking keeps a 172.16/12 LAN (kernel ABI sysfs-class-net)."""
def read(name: str, attr: str) -> str:
- with open(f"{sysfs}/{name}/{attr}") as handle:
+ with open(f"{sysfs}/{name}/{attr}", encoding = "utf-8") as handle:
return handle.read().strip()
try:
diff --git a/tests/test_fp8_dequant_save_policy.py b/tests/test_fp8_dequant_save_policy.py
index f4d071824da..e95f6dd5c05 100644
--- a/tests/test_fp8_dequant_save_policy.py
+++ b/tests/test_fp8_dequant_save_policy.py
@@ -43,7 +43,7 @@ def _restore_fp8_integration(monkeypatch):
def _helper():
# Exact source, without importing unsloth (which needs an accelerator).
path = ROOT / "unsloth" / "models" / "loader_utils.py"
- tree = ast.parse(path.read_text())
+ tree = ast.parse(path.read_text(encoding = "utf-8"))
fn = [
n
for n in tree.body
@@ -143,7 +143,7 @@ def test_composite_model_keeps_every_scoped_counterpart(tmp_path):
def _calls_and_guards(path, cls_name):
- tree = ast.parse(path.read_text())
+ tree = ast.parse(path.read_text(encoding = "utf-8"))
cls = next(n for n in tree.body if isinstance(n, ast.ClassDef) and n.name == cls_name)
fn = next(n for n in cls.body if isinstance(n, ast.FunctionDef) and n.name == "from_pretrained")
found = []
diff --git a/tests/test_fsdp2_save_gloo.py b/tests/test_fsdp2_save_gloo.py
index 556b7ffb512..204e7138115 100644
--- a/tests/test_fsdp2_save_gloo.py
+++ b/tests/test_fsdp2_save_gloo.py
@@ -21,6 +21,7 @@ from pathlib import Path
import pytest
import torch
+from real_accelerator import has_real_cuda
_ROOT = Path(__file__).resolve().parents[1]
@@ -1000,7 +1001,8 @@ def test_full_dcp_load_refuses_a_packed_4bit_weight_without_its_quant_state():
@pytest.mark.skipif(
- not torch.cuda.is_available()
+ not has_real_cuda()
+ or not torch.cuda.is_available()
or torch.cuda.device_count() < 2
or not torch.distributed.is_nccl_available(),
reason = "needs two CUDA GPUs and NCCL",
diff --git a/tests/test_qat_microscaling_schemes.py b/tests/test_qat_microscaling_schemes.py
index e1aee3bc2ef..9f68efd85d5 100644
--- a/tests/test_qat_microscaling_schemes.py
+++ b/tests/test_qat_microscaling_schemes.py
@@ -10,6 +10,7 @@ import warnings
import pytest
import torch
+from real_accelerator import has_real_cuda
pytestmark = pytest.mark.skipif(
importlib.util.find_spec("torchao") is None, reason = "require torchao"
@@ -105,7 +106,9 @@ def test_nvfp4_needs_in_features_divisible_by_32(monkeypatch, lora):
@pytest.mark.skipif(
- not torch.cuda.is_available() or torch.cuda.get_device_capability() < (10, 0),
+ not has_real_cuda()
+ or not torch.cuda.is_available()
+ or torch.cuda.get_device_capability() < (10, 0),
reason = "needs an FP4 tensor core GPU",
)
def test_nvfp4_admitted_widths_run_on_gpu():