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.

Route today's new PowerShell test calls through the shared runner (#11285)

Daniel Hane05acf5d0037
diff --git a/tests/python/test_compiler_watch_temp_scan.py b/tests/python/test_compiler_watch_temp_scan.py
index 874ac5d4d82..3df4ab7391b 100644
--- a/tests/python/test_compiler_watch_temp_scan.py
+++ b/tests/python/test_compiler_watch_temp_scan.py
@@ -32,6 +32,8 @@ import subprocess
import pytest
+from unsloth_pwsh_runner import run_pwsh
+
REPO = pathlib.Path(__file__).resolve().parents[2]
SCRIPT = REPO / ".github" / "scripts" / "Watch-ForCompiler.ps1"
@@ -69,7 +71,7 @@ def _says(proc: subprocess.CompletedProcess, phrase: str) -> bool:
def _run_pwsh(body: str) -> subprocess.CompletedProcess:
script = f"$ErrorActionPreference = 'Stop'\n. '{SCRIPT}'\n{body}"
- return subprocess.run(
+ return run_pwsh(
[PWSH, "-NoProfile", "-NonInteractive", "-Command", script],
capture_output = True,
text = True,
@@ -199,7 +201,7 @@ def test_the_scan_refuses_to_report_a_truncated_snapshot(tmp_path: pathlib.Path)
(tmp_path / f"d{i}").mkdir()
holder = tmp_path / "small.ps1"
holder.write_text(small, encoding = "utf-8")
- proc = subprocess.run(
+ proc = run_pwsh(
[
PWSH,
"-NoProfile",
@@ -234,7 +236,7 @@ def test_the_artifact_filter_still_selects_by_extension(tmp_path: pathlib.Path)
f"$env:TMP = '{tmp_path}'\n"
"(Get-StudioTempArtifacts).Files | ForEach-Object { Write-Output (Split-Path -Leaf $_) }\n"
)
- proc = subprocess.run(
+ proc = run_pwsh(
[PWSH, "-NoProfile", "-NonInteractive", "-Command", script],
capture_output = True,
text = True,
diff --git a/tests/test_studio_install_workspace_guard.py b/tests/test_studio_install_workspace_guard.py
index 332b1ceb61e..79cfad745a8 100644
--- a/tests/test_studio_install_workspace_guard.py
+++ b/tests/test_studio_install_workspace_guard.py
@@ -11,6 +11,8 @@ from pathlib import Path
import pytest
+from unsloth_pwsh_runner import run_pwsh
+
REPO_ROOT = Path(__file__).resolve().parents[1]
INSTALL_SH = REPO_ROOT / "install.sh"
INSTALL_PS1 = REPO_ROOT / "install.ps1"
@@ -416,7 +418,7 @@ def test_setup_ps1_stale_sweep_only_removes_its_own_litter(tmp_path):
)
script = tmp_path / "sweep.ps1"
script.write_text(preamble + sweep + "\n", encoding = "utf-8")
- subprocess.run(
+ run_pwsh(
["pwsh", "-NoProfile", "-File", str(script)],
check = True,
capture_output = True,
@@ -458,13 +460,13 @@ def test_setup_ps1_stale_sweep_refuses_a_custom_root_it_cannot_claim(tmp_path):
)
script = tmp_path / "sweep_custom.ps1"
script.write_text(preamble + sweep + "\n", encoding = "utf-8")
- subprocess.run(["pwsh", "-NoProfile", "-File", str(script)], check = True, capture_output = True)
+ run_pwsh(["pwsh", "-NoProfile", "-File", str(script)], check = True, capture_output = True)
assert litter.exists(), "an unclaimable custom root must be left entirely alone"
# Negative control: the same tree with the ownership marker present is swept, so the assertion
# above is about ownership and not about some other reason nothing was deleted.
(venv / ".unsloth-studio-owned").write_text("", encoding = "utf-8")
- subprocess.run(["pwsh", "-NoProfile", "-File", str(script)], check = True, capture_output = True)
+ run_pwsh(["pwsh", "-NoProfile", "-File", str(script)], check = True, capture_output = True)
assert not litter.exists(), "a custom root carrying the owned marker is ours to tidy"
@@ -517,7 +519,7 @@ class TestSetupHostInterpreterInVenv:
"import subprocess, sys; sys.exit(subprocess.call(sys.argv[1:]))",
*cmd,
]
- out = subprocess.run(cmd, env = env, text = True, capture_output = True, timeout = 120)
+ out = run_pwsh(cmd, env = env, text = True, capture_output = True, timeout = 120)
assert out.returncode == 0, out.stdout + out.stderr
return out.stdout.strip().splitlines()[-1]