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.

Fake the Windows blocklist in the mangled-switch test so it runs off Windows (#7934)

Daniel Hanf9b7f4a6a42b
diff --git a/studio/backend/tests/test_windows_bash_shell.py b/studio/backend/tests/test_windows_bash_shell.py
index 665057d04ae..87342b565cf 100644
--- a/studio/backend/tests/test_windows_bash_shell.py
+++ b/studio/backend/tests/test_windows_bash_shell.py
@@ -284,10 +284,17 @@ def test_notes_say_where_commands_run(monkeypatch):
r'cmd //c start /d C:/tmp "" powershell -Command ls',
],
)
-def test_cmd_shellout_is_screened_through_mangled_switches(command):
+def test_cmd_shellout_is_screened_through_mangled_switches(monkeypatch, command):
# Git Bash turns a lone /c into a path, so a model writes //c. That spelling
# skipped the nested scan, making `cmd //c powershell` reachable where
# `cmd /c powershell` was blocked, and `start` launches its argument too.
+ # _BLOCKED_COMMANDS resolves the Windows names at import, so patching
+ # sys.platform is too late; fake the resolved set instead.
+ monkeypatch.setattr(
+ tools,
+ "_BLOCKED_COMMANDS",
+ tools._BLOCKED_COMMANDS_COMMON | tools._BLOCKED_COMMANDS_WIN,
+ )
assert tools._find_blocked_commands(command)