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: screen the detached-window test against the Windows blocklist too (#7936)

Daniel Hanb41b819a4ec7
diff --git a/studio/backend/tests/test_windows_bash_shell.py b/studio/backend/tests/test_windows_bash_shell.py
index 87342b565cf..921bce7b820 100644
--- a/studio/backend/tests/test_windows_bash_shell.py
+++ b/studio/backend/tests/test_windows_bash_shell.py
@@ -272,6 +272,17 @@ def test_notes_say_where_commands_run(monkeypatch):
assert "opens a window on the user's desktop" in tools._build_terminal_shell_note()
+def _windows_blocklist(monkeypatch):
+ # _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,
+ )
+
+
@pytest.mark.parametrize(
"command",
[
@@ -284,17 +295,10 @@ 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(monkeypatch, command):
+def test_cmd_shellout_is_screened_through_mangled_switches(command, _windows_blocklist):
# 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)
@@ -307,7 +311,9 @@ def test_cmd_shellout_is_screened_through_mangled_switches(monkeypatch, command)
"start notepad",
],
)
-def test_detached_windows_stay_launchable(command):
+def test_detached_windows_stay_launchable(command, _windows_blocklist):
# `start` is the only route to a window on the user's desktop, which the
# terminal description promises, so screening must not blanket-block cmd.
+ # The blocklist is faked here too, or the Linux runner asserts this against
+ # a set with no powershell in it and cannot see a blanket block at all.
assert not tools._find_blocked_commands(command)