diff --git a/run_release.py b/run_release.py index 20ea6c32..b136be27 100755 --- a/run_release.py +++ b/run_release.py @@ -1039,7 +1039,10 @@ def wait_until_all_files_are_in_folder(db: ReleaseShelf) -> None: raise FileNotFoundError( f"The release folder in {destination} has not been created" ) from None - are_windows_files_there = f"python-{release}.exe" in all_files + if db["release"].as_tuple() >= (3, 16): + are_windows_files_there = f"windows-{release}.json" in all_files + else: + are_windows_files_there = f"python-{release}.exe" in all_files are_macos_files_there = f"python-{release}-macos11.pkg" in all_files are_linux_files_there = f"Python-{release}.tgz" in all_files diff --git a/tests/test_run_release.py b/tests/test_run_release.py index 35008a59..39ab2616 100644 --- a/tests/test_run_release.py +++ b/tests/test_run_release.py @@ -6,6 +6,7 @@ from contextlib import nullcontext as does_not_raise from pathlib import Path from typing import Any, cast +from unittest.mock import Mock import pytest @@ -258,3 +259,33 @@ def test_update_whatsnew_toctree(tmp_path: Path) -> None: # Assert new_contents = toctree__file.read_text() assert " 3.15.rst\n 3.14.rst\n" in new_contents + + +@pytest.mark.parametrize( + ("version", "windows_file"), + [ + ("3.15.0a1", "python-3.15.0a1.exe"), + ("3.16.0a1", "windows-3.16.0a1.json"), + ], +) +def test_wait_until_all_files_are_in_folder_windows( + monkeypatch: pytest.MonkeyPatch, version: str, windows_file: str +) -> None: + files = [f"Python-{version}.tgz", f"python-{version}-macos11.pkg"] + client = Mock() + ftp_client = client.open_sftp.return_value + ftp_client.listdir.side_effect = [files, [*files, windows_file]] + monkeypatch.setattr("run_release.paramiko.SSHClient", lambda: client) + sleep = Mock() + monkeypatch.setattr("run_release.time.sleep", sleep) + db = { + "release": Tag(version), + "security_release": False, + "ssh_user": "release-manager", + "ssh_key": None, + } + + run_release.wait_until_all_files_are_in_folder(cast(ReleaseShelf, db)) + + assert ftp_client.listdir.call_count == 2 + sleep.assert_called_once_with(1)