diff --git a/tests/test_windows_subprocess_no_window_flags.py b/tests/test_windows_subprocess_no_window_flags.py index 21c563646f..d1e49a4909 100644 --- a/tests/test_windows_subprocess_no_window_flags.py +++ b/tests/test_windows_subprocess_no_window_flags.py @@ -78,12 +78,19 @@ def test_bounded_git_probe_fast_path_spawn_contract_windows(monkeypatch): helper caches from the real platform at import. ``windows_hide_flags`` is still stubbed so the expected value is a fixed constant rather than whatever bundle the helper currently returns. + + The seam is the Job-Object container (``local_runtime.processes.spawn_server``), + which is what the probe hands its spawn contract to on Windows; the container + itself adds CREATE_SUSPENDED and assigns the real process handle, which a fake + Popen cannot provide. """ from hermes_cli import _subprocess_compat + from hermes_cli.local_runtime import processes spawns = [] + fake_popen = _make_fake_popen(spawns, stdout="main\n") monkeypatch.setattr(_subprocess_compat, "windows_hide_flags", lambda: _CREATE_NO_WINDOW) - monkeypatch.setattr(_subprocess_compat.subprocess, "Popen", _make_fake_popen(spawns, stdout="main\n")) + monkeypatch.setattr(processes, "spawn_server", lambda cmd, **kw: (fake_popen(cmd, **kw), None)) out = _subprocess_compat.bounded_git_probe( ["git", "-C", "C:/repo", "branch", "--show-current"], timeout=1.5