Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion run_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
31 changes: 31 additions & 0 deletions tests/test_run_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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)
Loading