Skip to content

Commit 93b13d3

Browse files
Check Windows release manifest for Python 3.16+ releases (#456)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
1 parent b6e2bdd commit 93b13d3

2 files changed

Lines changed: 35 additions & 1 deletion

File tree

‎run_release.py‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1039,7 +1039,10 @@ def wait_until_all_files_are_in_folder(db: ReleaseShelf) -> None:
10391039
raise FileNotFoundError(
10401040
f"The release folder in {destination} has not been created"
10411041
) from None
1042-
are_windows_files_there = f"python-{release}.exe" in all_files
1042+
if db["release"].as_tuple() >= (3, 16):
1043+
are_windows_files_there = f"windows-{release}.json" in all_files
1044+
else:
1045+
are_windows_files_there = f"python-{release}.exe" in all_files
10431046
are_macos_files_there = f"python-{release}-macos11.pkg" in all_files
10441047
are_linux_files_there = f"Python-{release}.tgz" in all_files
10451048

‎tests/test_run_release.py‎

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from contextlib import nullcontext as does_not_raise
77
from pathlib import Path
88
from typing import Any, cast
9+
from unittest.mock import Mock
910

1011
import pytest
1112

@@ -258,3 +259,33 @@ def test_update_whatsnew_toctree(tmp_path: Path) -> None:
258259
# Assert
259260
new_contents = toctree__file.read_text()
260261
assert " 3.15.rst\n 3.14.rst\n" in new_contents
262+
263+
264+
@pytest.mark.parametrize(
265+
("version", "windows_file"),
266+
[
267+
("3.15.0a1", "python-3.15.0a1.exe"),
268+
("3.16.0a1", "windows-3.16.0a1.json"),
269+
],
270+
)
271+
def test_wait_until_all_files_are_in_folder_windows(
272+
monkeypatch: pytest.MonkeyPatch, version: str, windows_file: str
273+
) -> None:
274+
files = [f"Python-{version}.tgz", f"python-{version}-macos11.pkg"]
275+
client = Mock()
276+
ftp_client = client.open_sftp.return_value
277+
ftp_client.listdir.side_effect = [files, [*files, windows_file]]
278+
monkeypatch.setattr("run_release.paramiko.SSHClient", lambda: client)
279+
sleep = Mock()
280+
monkeypatch.setattr("run_release.time.sleep", sleep)
281+
db = {
282+
"release": Tag(version),
283+
"security_release": False,
284+
"ssh_user": "release-manager",
285+
"ssh_key": None,
286+
}
287+
288+
run_release.wait_until_all_files_are_in_folder(cast(ReleaseShelf, db))
289+
290+
assert ftp_client.listdir.call_count == 2
291+
sleep.assert_called_once_with(1)

0 commit comments

Comments
 (0)