Pin board_build.flash_mode unconditionally, dispatch native backends by toolchain, report a skipped size summary

This commit is contained in:
J. Nick Koston
2026-08-23 17:46:23 -05:00
parent d59f6eb46d
commit fde0a835b6
7 changed files with 51 additions and 50 deletions
@@ -500,12 +500,13 @@ def test_print_size_summary_missing_section_skips_summary(
def test_warn_ignored_platformio_options(caplog: pytest.LogCaptureFixture) -> None:
"""Component-added options the native build drops are warned by name;
the honored ones (lib_ignore, f_cpu, ldscript, build_src_flags) stay
quiet."""
the honored ones (lib_ignore, f_cpu, ldscript, build_src_flags,
flash_mode) stay quiet."""
CORE.platformio_options = {
"board_build.ldscript": "eagle.flash.4m2m.ld",
"board_build.f_cpu": "160000000L",
"board_build.filesystem": "littlefs",
"board_build.flash_mode": "dio",
"build_src_flags": "-include throw_stubs.h",
"lib_ignore": ["Updater"],
"upload_speed": "460800",
@@ -517,6 +518,7 @@ def test_warn_ignored_platformio_options(caplog: pytest.LogCaptureFixture) -> No
assert "board_build.f_cpu is ignored" not in caplog.text
assert "lib_ignore" not in caplog.text
assert "build_src_flags" not in caplog.text
assert "flash_mode" not in caplog.text
# Component-added upload_speed never gets read under the native
# toolchain, so it must warn
assert "upload_speed" in caplog.text
+9 -6
View File
@@ -7390,12 +7390,15 @@ def test_compile_program_espidf_idedata_none_warns(
assert "No idedata was generated" in caplog.text
def test_native_toolchain_module_missing_hook_raises(tmp_path: Path) -> None:
"""A resolved native toolchain whose platform lacks the hook is a bug
and must fail, not silently degrade to the PlatformIO path."""
setup_core(platform=PLATFORM_ESP32, tmp_path=tmp_path, name="test_device")
CORE.toolchain = Toolchain.ARDUINO # esp32 provides no hook
with pytest.raises(EsphomeError, match="no native toolchain module"):
def test_native_toolchain_module_missing_backend_raises(tmp_path: Path) -> None:
"""A native toolchain missing from the backend table is a bug and must
fail, not silently degrade to the PlatformIO path."""
setup_core(platform=PLATFORM_ESP8266, tmp_path=tmp_path, name="test_device")
CORE.toolchain = Toolchain.ARDUINO
with (
patch.dict(main._NATIVE_TOOLCHAIN_MODULES, clear=True),
pytest.raises(EsphomeError, match="no native build backend"),
):
_native_toolchain_module()