test(windows): capture only the bootstrap _run_bash, not the failure probe

init_session now fires a follow-up non-login `bash -c true` probe when the
login bootstrap fails, so the two bootstrap-script assertions must capture
the first call only (setdefault), not the probe that overwrote it.
This commit is contained in:
Brooklyn Nicholson 2026-07-13 16:51:08 -04:00
parent c4622a1d5b
commit c707165212

View file

@ -161,8 +161,8 @@ class TestAtomicSnapshotWrite:
captured = {}
def fake_run_bash(cmd_string, *, login=False, timeout=120, stdin_data=None):
captured["cmd"] = cmd_string
raise RuntimeError("stop after capture") # we only need the script
captured.setdefault("cmd", cmd_string) # only the bootstrap; ignore the failure-path probe
raise RuntimeError("stop after capture")
env._run_bash = fake_run_bash # type: ignore[assignment]
try:
@ -188,7 +188,7 @@ class TestAtomicSnapshotWrite:
captured = {}
def fake_run_bash(cmd_string, *, login=False, timeout=120, stdin_data=None):
captured["cmd"] = cmd_string
captured.setdefault("cmd", cmd_string) # only the bootstrap; ignore the failure-path probe
raise RuntimeError("stop after capture")
env._run_bash = fake_run_bash # type: ignore[assignment]