DEVX-144: fix: bake promtool into ci-full image, add download timeout, speed up tests
Post-merge / release-and-maintain (push) Waiting to run
Post-merge / detect-and-configure (push) Waiting to run

This commit was merged in pull request #226.
This commit is contained in:
2026-07-17 02:10:17 +00:00
parent c7351a495a
commit d743ba93eb
4 changed files with 24 additions and 10 deletions
+17 -5
View File
@@ -47,13 +47,25 @@ class TestDownload:
def test_download(self, tmp_path: Path) -> None:
dest = tmp_path / "file.bin"
def _write_file(url: str, path: Path) -> tuple[str, None]:
Path(path).write_bytes(b"data")
return str(path), None
class _FakeResponse:
def __init__(self) -> None:
self._sent = False
with patch("urllib.request.urlretrieve", side_effect=_write_file) as mock_retrieve:
def __enter__(self) -> _FakeResponse:
return self
def __exit__(self, *args: object) -> None:
pass
def read(self, n: int = -1) -> bytes:
if self._sent:
return b""
self._sent = True
return b"data"
with patch("urllib.request.urlopen", return_value=_FakeResponse()) as mock_urlopen:
install_tools._download("https://example.com/file", dest)
mock_retrieve.assert_called_once()
mock_urlopen.assert_called_once()
assert dest.read_bytes() == b"data"