Skip to content

Commit 56da691

Browse files
committed
test(update): respect native Windows archive update boundary
Signed-off-by: jackie-cqz <2557911191@qq.com>
1 parent 81ea66a commit 56da691

1 file changed

Lines changed: 25 additions & 4 deletions

File tree

‎tests/test_self_update_runtime_activation.py‎

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -770,13 +770,27 @@ def fake_run(
770770

771771

772772
@pytest.mark.skipif(os.name != "nt", reason="native Windows update boundary")
773-
def test_windows_execute_update_fails_closed_without_launching_bash() -> None:
773+
@pytest.mark.parametrize("selected_route", [False, True])
774+
def test_windows_execute_update_fails_closed_without_launching_bash(
775+
tmp_path: Path, selected_route: bool,
776+
) -> None:
774777
payload = {"ok": True, "source": {}, "plan": {}}
778+
route = (
779+
{
780+
"registry_path": tmp_path / "project/.loopx/registry.json",
781+
"runtime_root": str(tmp_path / "selected runtime"),
782+
}
783+
if selected_route else {}
784+
)
775785

776-
with mock.patch("loopx.self_update.subprocess.run") as run:
777-
updated = execute_update_plan(payload)
786+
with (
787+
mock.patch("loopx.self_update.subprocess.run") as run,
788+
mock.patch("loopx.self_update.run_archive_installer") as install,
789+
):
790+
updated = execute_update_plan(payload, **route)
778791

779792
run.assert_not_called()
793+
install.assert_not_called()
780794
assert updated["ok"] is False
781795
assert updated["execution"]["status"] == "unsupported_platform"
782796
assert "install-windows.ps1" in updated["recommended_action"]
@@ -800,7 +814,14 @@ def test_failed_authority_upgrade_does_not_activate_services_or_continue_host_up
800814
restart.assert_not_called()
801815

802816

803-
@pytest.mark.parametrize("driver", ["archive_snapshot", "python_pip", "python_pipx"])
817+
@pytest.mark.parametrize("driver", [
818+
pytest.param(
819+
"archive_snapshot",
820+
marks=pytest.mark.skipif(os.name == "nt", reason="archive updates require a POSIX host"),
821+
),
822+
"python_pip",
823+
"python_pipx",
824+
])
804825
def test_update_preserves_selected_route_through_install_and_readback(tmp_path, monkeypatch, driver):
805826
registry, runtime = tmp_path / "project/.loopx/registry.json", tmp_path / "selected runtime"
806827
payload = build_update_plan(action="apply", doctor_payload=doctor_payload())

0 commit comments

Comments
 (0)