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.
Python agentaichatgptdeepseekfine-tuninggemmaimage-generationllamallmllmsopenaipythonqwenreinforcement-learningself-hostedstable-diffusiontext-to-speechttsuiunsloth
Studio: mark the POSIX-only prompt tests, and pin the Windows answer
Daniel Han055470f463c2
diff --git a/studio/backend/tests/test_password_prompt_backstop.py b/studio/backend/tests/test_password_prompt_backstop.pyindex 093145080b2..9918c4e1ba4 100644--- a/studio/backend/tests/test_password_prompt_backstop.py+++ b/studio/backend/tests/test_password_prompt_backstop.py@@ -580,6 +580,12 @@ class _FdStream(_Stream):return 0+ os.name == "nt",+ reason = "POSIX terminal semantics: Windows has no process groups, no SIGTTOU and no pty, "+ "so there is nothing here to assert. _prompt_owns_the_terminal fails open there, "+ "which test_windows_has_no_terminal_ownership_to_lose pins.",+)def test_a_backgrounded_raw_bind_does_not_prompt(monkeypatch):"""`unsloth studio -H 0.0.0.0 &` must still launch.@@ -602,6 +608,12 @@ def test_a_backgrounded_raw_bind_does_not_prompt(monkeypatch):assert run._terminal_password_gate(tunnel_will_start = False, **_RAW_BIND_KWARGS) == (True, False)+ os.name == "nt",+ reason = "POSIX terminal semantics: Windows has no process groups, no SIGTTOU and no pty, "+ "so there is nothing here to assert. _prompt_owns_the_terminal fails open there, "+ "which test_windows_has_no_terminal_ownership_to_lose pins.",+)def test_a_backgrounded_tunnel_launch_still_fails_closed(monkeypatch):"""A tunnel publishes a public URL: it must not quietly proceed unprompted."""monkeypatch.setattr(sys, "stdin", _FdStream())@@ -617,6 +629,12 @@ def test_a_backgrounded_tunnel_launch_still_fails_closed(monkeypatch):assert run._terminal_password_gate(tunnel_will_start = True, **_GATE_KWARGS) == (False, False)+ os.name == "nt",+ reason = "POSIX terminal semantics: Windows has no process groups, no SIGTTOU and no pty, "+ "so there is nothing here to assert. _prompt_owns_the_terminal fails open there, "+ "which test_windows_has_no_terminal_ownership_to_lose pins.",+)def test_a_foreground_raw_bind_still_reaches_the_prompt(monkeypatch):"""The ordinary interactive case is untouched."""monkeypatch.setattr(sys, "stdin", _FdStream())@@ -660,6 +678,12 @@ class _PtyStdin:return True+ os.name == "nt",+ reason = "POSIX terminal semantics: Windows has no process groups, no SIGTTOU and no pty, "+ "so there is nothing here to assert. _prompt_owns_the_terminal fails open there, "+ "which test_windows_has_no_terminal_ownership_to_lose pins.",+)def test_an_unattended_pty_does_not_block_a_raw_bind_forever(monkeypatch):"""`tmux new -d 'unsloth studio -H 0.0.0.0'` must still bind its socket.@@ -691,6 +715,12 @@ def test_an_unattended_pty_does_not_block_a_raw_bind_forever(monkeypatch):assert "No response at the terminal" in out.getvalue()+ os.name == "nt",+ reason = "POSIX terminal semantics: Windows has no process groups, no SIGTTOU and no pty, "+ "so there is nothing here to assert. _prompt_owns_the_terminal fails open there, "+ "which test_windows_has_no_terminal_ownership_to_lose pins.",+)def test_a_pty_someone_types_into_is_not_treated_as_unattended(monkeypatch):"""The deadline is on the FIRST keystroke only, and a real one clears it."""import io@@ -816,3 +846,17 @@ def test_the_marker_never_silences_a_tunnel_launch(monkeypatch):monkeypatch.setattr(terminal_prompt, "prompt_for_password_change", lambda **_kw: False)assert run._terminal_password_gate(tunnel_will_start = True, **_GATE_KWARGS) == (False, False)+++def test_windows_has_no_terminal_ownership_to_lose(monkeypatch):+ """The Windows half of the tests skipped above, and it runs everywhere.++ `_prompt_owns_the_terminal` exists to catch a backgrounded POSIX job, where+ driving the terminal raises SIGTTOU and stops the process. Windows has no+ process groups and no `os.tcgetpgrp`, so the call raises AttributeError and+ the answer must be True: there is nothing there that can stop us, so the+ isatty verdict stands and an interactive Windows launch still prompts. A+ False would silently drop the prompt on every Windows terminal.+ """+ monkeypatch.delattr(run.os, "tcgetpgrp", raising = False)+ assert run._prompt_owns_the_terminal() is Truediff --git a/unsloth_cli/tests/test_studio_password_prompt.py b/unsloth_cli/tests/test_studio_password_prompt.pyindex 5159da8a0c3..e9c6d1441b8 100644--- a/unsloth_cli/tests/test_studio_password_prompt.py+++ b/unsloth_cli/tests/test_studio_password_prompt.py@@ -14,6 +14,7 @@ from __future__ import annotationsimport ioimport sqlite3+import osimport sysfrom pathlib import Path@@ -1921,6 +1922,12 @@ def test_a_backgrounded_raw_bind_does_not_prompt(monkeypatch):)+ os.name == "nt",+ reason = "POSIX terminal semantics: Windows has no process groups, no SIGTTOU and no pty, "+ "so there is nothing here to assert. _prompt_owns_the_terminal fails open there, "+ "which test_windows_has_no_terminal_ownership_to_lose pins.",+)def test_a_foreground_raw_bind_still_prompts(monkeypatch):"""The ordinary interactive case is untouched."""studio = _studio()@@ -2040,6 +2047,12 @@ def test_a_raw_bind_prompt_carries_the_unattended_deadline(monkeypatch, tmp_pathassert seen["first_key_timeout"] == studio_mod._UNATTENDED_PROMPT_SECONDS+ os.name == "nt",+ reason = "POSIX terminal semantics: Windows has no process groups, no SIGTTOU and no pty, "+ "so there is nothing here to assert. _prompt_owns_the_terminal fails open there, "+ "which test_windows_has_no_terminal_ownership_to_lose pins.",+)def test_read_masked_gives_up_on_a_pty_nobody_types_into(monkeypatch):"""The mechanism itself, against a real pty with no writer."""import os