Cover the healthy post-compile idedata path

This commit is contained in:
J. Nick Koston
2026-08-20 20:53:30 -05:00
parent 73ab04330e
commit 6b6344b454
+29
View File
@@ -7173,6 +7173,35 @@ def test_compile_program_espidf_idedata_failure_does_not_fail_build(
assert "Could not generate idedata" in caplog.text
def test_compile_program_espidf_idedata_success_is_silent(
caplog: pytest.LogCaptureFixture,
) -> None:
"""The healthy path: idedata generated, nothing to warn about."""
from esphome.const import (
KEY_CORE,
KEY_TARGET_FRAMEWORK,
KEY_TARGET_PLATFORM,
Toolchain,
)
from esphome.core import CORE
CORE.toolchain = Toolchain.ESP_IDF
CORE.data[KEY_CORE] = {
KEY_TARGET_PLATFORM: "esp32",
KEY_TARGET_FRAMEWORK: "esp-idf",
}
with (
patch("esphome.espidf.toolchain.run_compile", return_value=0),
patch("esphome.espidf.toolchain.create_factory_bin"),
patch("esphome.espidf.toolchain.create_ota_bin"),
patch("esphome.espidf.toolchain.create_elf_copy"),
patch("esphome.espidf.toolchain.get_idedata", return_value={"cc_path": "x"}),
patch("esphome.__main__._check_and_emit_build_info"),
):
assert compile_program(MagicMock(), {}) == 0
assert "idedata" not in caplog.text
def test_compile_program_espidf_idedata_none_warns(
caplog: pytest.LogCaptureFixture,
) -> None: