Merge pull request #1999 from debpalash/fix/windows-backend-tests

test: make the isolated backend session pass on Windows, and gate it there
This commit is contained in:
Palash Debnath
2026-09-10 01:07:27 -07:00
committed by GitHub
5 changed files with 37 additions and 1 deletions
+14
View File
@@ -443,6 +443,20 @@ jobs:
HF_HUB_OFFLINE: "1" # same no-silent-downloads guard as the main pytest job
HF_HUB_CACHE: ${{ runner.temp }}/pockettts-empty-hf-cache
# The isolated backend session, on Windows. The `test` job runs it on
# Linux only, which is how four tests that CANNOT pass on Windows shipped
# unnoticed: two reach for os.WNOHANG and os.waitid (POSIX-only, an
# AttributeError before the first assertion), one asserts a RuntimeError
# that `backend_drain_fd` returns None instead of raising off POSIX, and
# one raced the OS reaping a crashed child — a race Linux won and Windows
# lost every time. All four were invisible to CI and hit every Windows
# contributor on their first `pytest` run. Forty seconds closes the class.
- name: Isolated backend session (Windows)
if: runner.os == 'Windows' && matrix.backend_supported
run: uv run --no-sync pytest backend/tests/ -q --tb=short
env:
HF_HUB_OFFLINE: "1"
# Artifact commits depend on native Windows rename/replace semantics;
# Linux emulation cannot exercise sharing rules or path parsing.
- name: Remote-worker artifact paths (Windows)
+2
View File
@@ -94,6 +94,8 @@ the frozen-backend fallback mirror it for their toolchains.
### Fixed
- The isolated backend test session passes on a stock Windows checkout, and CI now runs it there so it stays that way (#1990)
- Windows contributors can run the test suite without Developer Mode: tests that create a symlink now skip instead of failing with `WinError 1314` (#1990)
- The crash details dialog now says what the exit code means and what to try, instead of showing a raw number and a log (#1927)
@@ -120,6 +120,7 @@ def test_drain_fd_is_explicitly_inherited_by_wrapper_but_not_operation(monkeypat
proc.wait(timeout=5)
@pytest.mark.skipif(os.name != "posix", reason="Unix drain pipe contract")
def test_invalid_or_missing_desktop_drain_fd_fails_safe(monkeypatch):
monkeypatch.setenv("OMNIVOICE_DESKTOP_CONTAINED", "1")
monkeypatch.setenv("OMNIVOICE_DESKTOP_DRAIN_FD", "not-an-fd")
@@ -15,6 +15,15 @@ import pytest
from core import contained_subprocess as owned
# This module simulates macOS by deleting os.waitid, then drives the fallback
# with os.waitpid/os.WNOHANG and start_new_session — POSIX-only APIs that
# Windows does not have at all (os.WNOHANG raises AttributeError before the
# first assertion). CI runs this suite on Linux, so nothing is lost by
# skipping; what is gained is a Windows contributor whose checkout runs green.
pytestmark = pytest.mark.skipif(
os.name != "posix", reason="simulates a POSIX platform without os.waitid"
)
def _make_owned(argv):
cr, cw = os.pipe()
+11 -1
View File
@@ -472,7 +472,17 @@ def test_mps_proxy_survives_fatal_child_exit_and_recovers(stub_sidecar, monkeypa
try:
with pytest.raises(RuntimeError, match="backend is still running"):
b.generate("CRASH")
assert b._proc is not None and b._proc.poll() is not None
assert b._proc is not None
# The child called os._exit; the parent raised the moment its pipe hit
# EOF, which is BEFORE the OS has reaped the process. Asserting poll()
# on the next line is a race the test happened to win on Linux and lost
# every time on Windows. Wait for the death instead of assuming it has
# already been observed — the claim is that the child is gone, not that
# it is gone within one instruction.
deadline = time.monotonic() + 5
while b._proc.poll() is None and time.monotonic() < deadline:
time.sleep(0.02)
assert b._proc.poll() is not None, "the crashed sidecar never died"
assert b.generate("ok").shape[1] == 24000
finally:
b.shutdown()