[core] Create the PlatformIO HTTP cache dir before the prefetch resolve threads run (#20579)

This commit is contained in:
J. Nick Koston
2026-10-12 07:28:07 -04:00
committed by GitHub
parent 3472ac3dcc
commit c0d4287c6e
5 changed files with 46 additions and 4 deletions
@@ -561,6 +561,19 @@ def test_registry_lock_deadline_skips_registration(tmp_path: Path) -> None:
manager.set_download_utime.assert_not_called()
def test_prefetch_creates_http_cache_dir_first(
monkeypatch: pytest.MonkeyPatch, tmp_path: Path
) -> None:
"""Eight resolve threads each build a registry client whose cache
init has no exist_ok; the dir must exist before any of them run."""
from platformio.project import helpers
monkeypatch.setattr(helpers, "get_project_cache_dir", lambda: str(tmp_path))
with patch.object(pf, "_project_platform_and_config", return_value=(None, None)):
pf._prefetch(tmp_path, "testenv")
assert (tmp_path / "http").is_dir()
def test_main_interrupt_exits_quietly(tmp_path: Path) -> None:
"""Ctrl-C reaches the child via the shared process group; it must exit
without a traceback."""