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.

Studio: make three RAG tests hold on Windows (#10530)

Daniel Han5177a5b1d0fe
diff --git a/studio/backend/tests/test_rag_embed_llama_server.py b/studio/backend/tests/test_rag_embed_llama_server.py
index e56dc5bc397..236590f4c96 100644
--- a/studio/backend/tests/test_rag_embed_llama_server.py
+++ b/studio/backend/tests/test_rag_embed_llama_server.py
@@ -869,7 +869,7 @@ def test_cached_gguf_is_found_in_a_subdirectory(monkeypatch, tmp_path):
_seed_cache(tmp_path / "hub", repo, ["F16/bge-small.gguf"])
_use_cache_root(monkeypatch, tmp_path / "hub")
resolved = LlamaServerBackend._resolve_cached_gguf(repo)
- assert resolved is not None and resolved.endswith("F16/bge-small.gguf")
+ assert resolved is not None and Path(resolved).parts[-2:] == ("F16", "bge-small.gguf")
def test_an_incomplete_cached_shard_set_is_not_a_hit(monkeypatch, tmp_path):
diff --git a/studio/backend/tests/test_rag_embeddings.py b/studio/backend/tests/test_rag_embeddings.py
index 0efb005e00a..51397da15c7 100644
--- a/studio/backend/tests/test_rag_embeddings.py
+++ b/studio/backend/tests/test_rag_embeddings.py
@@ -22,8 +22,15 @@ from core.rag import config, embeddings
# RLIMIT_CORE = 0 does NOT work here, because a piped core_pattern ignores it.
# prctl is Linux-only, so the call is guarded and does nothing elsewhere.
_CRASHING_UNLESS_CPU_SCRIPT = (
- "import ctypes, sys\n"
+ "import ctypes, os, sys\n"
"if sys.argv[1] != 'cpu':\n"
+ # ctypes installs a structured exception handler on Windows, so the null read below
+ # comes back as an ordinary OSError and the child exits like any reporting child,
+ # which the probe reads as a working device. abort() is the real shape there: it is
+ # what a ROCm library calls when it dies, and it leaves the CRT exit status 3 the
+ # probe already recognises.
+ " if sys.platform == 'win32':\n"
+ " os.abort()\n"
" try:\n"
" ctypes.CDLL(None).prctl(4, 0, 0, 0, 0) # PR_SET_DUMPABLE = 0\n"
" except Exception:\n"
diff --git a/studio/backend/tests/test_rag_linked_folders.py b/studio/backend/tests/test_rag_linked_folders.py
index 4692c9fb3e6..7873f827a50 100644
--- a/studio/backend/tests/test_rag_linked_folders.py
+++ b/studio/backend/tests/test_rag_linked_folders.py
@@ -738,6 +738,10 @@ def test_reauthorizing_same_path_refreshes_root_identity_and_retains_mappings(
@pytest.mark.parametrize("source_name", ["source", "source "])
def test_directory_lease_contract_preserves_path_and_purpose(rag_home, source_name):
+ if source_name.endswith(" ") and os.name == "nt":
+ # Win32 strips a trailing space from a path component, so the two names are one
+ # directory there and the pair this case contrasts cannot be created at all.
+ pytest.skip("Windows cannot hold a directory whose name ends in a space")
source = rag_home / source_name
source.mkdir()
if source_name.endswith(" "):
diff --git a/studio/install_python_stack.py b/studio/install_python_stack.py
index d27931e11f9..cdab5c555cb 100644
--- a/studio/install_python_stack.py
+++ b/studio/install_python_stack.py
@@ -4433,9 +4433,7 @@ def _resync_torch_coupled_packages(label_before: str) -> bool:
# _pin_needs_reinstall, not an exact compare: ==0.18.0 never equals 0.18.0+cu130.
_ao_index = _torch_accelerator_index_url(_label_after)
_ao_args = ["--force-reinstall", "--no-deps", "--no-cache-dir"]
- if _pin_needs_reinstall(
- _spec, _torch_index_tag(_label_after) if _ao_index else ""
- ):
+ if _pin_needs_reinstall(_spec, _torch_index_tag(_label_after) if _ao_index else ""):
_note(f"torch {_label_after} after repair -- reinstalling {_spec}")
_touched_torch = True
_ao_ok = pip_install_try(
diff --git a/tests/studio/install/test_windows_torch_flavor_invariant.py b/tests/studio/install/test_windows_torch_flavor_invariant.py
index 7e064dc3dc2..438f1ca1b6a 100644
--- a/tests/studio/install/test_windows_torch_flavor_invariant.py
+++ b/tests/studio/install/test_windows_torch_flavor_invariant.py
@@ -294,7 +294,8 @@ class TestStepThirteenWiring:
# spec and the leaf are read from. Nothing else may join the set.
assert step13 == (
["_progress", "_torch_step_label", "_probe_installed_torch_version"]
- + repairs + ["_probe_installed_torch_version", "_note", "_install_torchao_for_torch"]
+ + repairs
+ + ["_probe_installed_torch_version", "_note", "_install_torchao_for_torch"]
), step13
assert "_install_torchao_for_torch" not in _calls_in(guards[0])