Address review: patch the prefetch subprocess, scope the in-process override to our client, isolate tests

This commit is contained in:
J. Nick Koston
2026-08-27 10:49:12 -05:00
parent 6a56dffd28
commit 9270f3fd34
5 changed files with 47 additions and 30 deletions
@@ -1151,6 +1151,19 @@ def test_main_runs_prefetch(tmp_path: Path) -> None:
mock_prefetch.assert_called_once_with(tmp_path, "testenv")
def test_main_skips_private_package_probe(tmp_path: Path) -> None:
"""The registry probe patch is applied before any package manager runs."""
with (
patch.object(pf, "_prefetch") as mock_prefetch,
patch(
"esphome.platformio.runner.patch_registry_private_packages"
) as mock_patch,
):
assert pf.main([str(tmp_path), "testenv"]) == 0
mock_patch.assert_called_once_with()
mock_prefetch.assert_called_once()
def test_main_bad_argv_is_a_distinct_exit(
caplog: pytest.LogCaptureFixture,
) -> None: