Merge branch 'esp8266-native-library-backend' into esp8266-native-build-spec

This commit is contained in:
J. Nick Koston
2026-08-23 18:45:15 -05:00
5 changed files with 52 additions and 11 deletions
+23
View File
@@ -1074,6 +1074,27 @@ def test_prefetch_failures_never_raise(
assert expected_log in caplog.text
def test_prefetch_total_failure_logs_error(
tmp_path: Path, caplog: pytest.LogCaptureFixture
) -> None:
"""Every archive failing is a systematic fault (proxy, bad kwarg), not
a flaky mirror; it must be distinguishable at ERROR because the resume
workaround is off for the whole install."""
with (
patch(
"esphome.espidf.framework.run_command",
return_value=(True, _PREFETCH_JSON, ""),
),
patch(
"esphome.espidf.framework.download_with_resume",
side_effect=OSError("proxy refuses everything"),
),
patch("esphome.espidf.framework.get_system_python_path", return_value="python"),
):
_prefetch_idf_tool_archives(tmp_path, "esp32", ["required"], None)
assert "Every ESP-IDF tool prefetch failed" in caplog.text
def test_prefetch_one_failed_archive_does_not_stop_the_rest(
tmp_path: Path, caplog: pytest.LogCaptureFixture
) -> None:
@@ -1099,6 +1120,8 @@ def test_prefetch_one_failed_archive_does_not_stop_the_rest(
assert download.call_count == 2
assert "Could not prefetch cmake@3.30.2" in caplog.text
# One flaky archive is routine, never the systematic-fault ERROR
assert "Every ESP-IDF tool prefetch failed" not in caplog.text
def test_prefetch_finishes_progress_bar_and_cancels_queue(tmp_path: Path) -> None:
+8 -3
View File
@@ -687,9 +687,11 @@ def test_join_flag_args_empty_argument_warns_and_drops(
def test_prefetch_wave_cache_probe_failure_still_prefetches(
monkeypatch: pytest.MonkeyPatch,
monkeypatch: pytest.MonkeyPatch, caplog: pytest.LogCaptureFixture
) -> None:
"""The cache probe is best-effort; a failing probe prefetches anyway."""
"""A filesystem probe failure warns (a systematic one re-downloads
everything) but still prefetches; a programming error is NOT swallowed
here, it reaches the outer blanket guard."""
calls: list[str] = []
monkeypatch.setattr(
URLSource,
@@ -699,7 +701,7 @@ def test_prefetch_wave_cache_probe_failure_still_prefetches(
monkeypatch.setattr(
URLSource,
"is_cached",
lambda self, *a, **kw: (_ for _ in ()).throw(RuntimeError("no core")),
lambda self, *a, **kw: (_ for _ in ()).throw(OSError("cache root denied")),
)
wave = [
("a", ConvertedLibrary("a", "1.0", URLSource("https://x/a.tar.gz", 1))),
@@ -707,12 +709,14 @@ def test_prefetch_wave_cache_probe_failure_still_prefetches(
]
lib._prefetch_wave(wave, "", "idf")
assert sorted(calls) == ["https://x/a.tar.gz", "https://x/b.tar.gz"]
assert "Cache probe for a failed: cache root denied" in caplog.text
def test_prefetch_wave_internal_error_never_fails_the_build(
monkeypatch: pytest.MonkeyPatch, caplog: pytest.LogCaptureFixture
) -> None:
"""The blanket guard keeps a prefetch bug from failing the walk."""
monkeypatch.setattr(URLSource, "is_cached", lambda self, *a, **kw: False)
monkeypatch.setattr(
lib,
"run_batch_downloads",
@@ -756,6 +760,7 @@ def test_prefetch_wave_single_archive_uses_the_batch(
through the same runner so there is one download method and one bar."""
caplog.set_level("INFO")
calls: list[str] = []
monkeypatch.setattr(URLSource, "is_cached", lambda self, *a, **kw: False)
monkeypatch.setattr(
URLSource,
"download",