Skip to content

Commit 4913069

Browse files
committed
Test that the Windows bootstrap refuses an unexpected uv version
Proofline review, round 4: the Windows tests always made the version check succeed, so executable() could ignore its result and still pass. A new test serves a zip with a valid checksum, makes the version check fail, and expects "The verified uv executable has an unexpected version." Ignoring the result (mutation) now fails the test.
1 parent 3ededd9 commit 4913069

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

‎tests/test_uv.py‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,17 @@ def test_windows_bootstrap_downloads_the_zip_and_saves_an_exe(
9191
assert checked == [binary]
9292

9393

94+
def test_windows_bootstrap_refuses_an_unexpected_uv_version(
95+
tmp_path: Path, monkeypatch: pytest.MonkeyPatch
96+
) -> None:
97+
content = windows_zip()
98+
fake_windows(monkeypatch, "AMD64", content)
99+
monkeypatch.setitem(uv.CHECKSUMS, "x86_64-pc-windows-msvc", hashlib.sha256(content).hexdigest())
100+
monkeypatch.setattr(uv, "matching", lambda executable: False)
101+
with pytest.raises(SystemExit, match="unexpected version"):
102+
uv.executable(tmp_path)
103+
104+
94105
@pytest.mark.parametrize(
95106
("cached", "message"),
96107
[(False, "release archive does not match"), (True, "cached uv archive does not match")],

0 commit comments

Comments
 (0)