From 1477de24d34ad6952960a8c179512b41742d09c8 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Thu, 20 Aug 2026 10:09:57 -0500 Subject: [PATCH] Skip the RAM and Flash summary lines together when the flash budget is unknown --- esphome/arduino8266/toolchain.py | 9 +++++++-- tests/unit_tests/test_arduino8266_toolchain.py | 5 +++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/esphome/arduino8266/toolchain.py b/esphome/arduino8266/toolchain.py index 6d2c2cde5d..553955e749 100644 --- a/esphome/arduino8266/toolchain.py +++ b/esphome/arduino8266/toolchain.py @@ -195,11 +195,16 @@ def _print_size_summary(build_dir: Path) -> None: ", ".join(sorted(missing)), ) return + # Resolve the flash budget before printing anything: a RAM line without + # its Flash line would let CI's memory-impact extraction sum the two + # metrics over different build counts (_parse_app_size already warned). + app_size = _parse_app_size(build_dir) + if not app_size: + return ram = sum(sections[s] for s in _RAM_SECTIONS) flash = sum(sections[s] for s in _FLASH_SECTIONS) print(f"RAM: {format_bar(ram, _MAX_RAM_SIZE)}") - if app_size := _parse_app_size(build_dir): - print(f"Flash: {format_bar(flash, app_size)}") + print(f"Flash: {format_bar(flash, app_size)}") def get_idedata() -> dict | None: diff --git a/tests/unit_tests/test_arduino8266_toolchain.py b/tests/unit_tests/test_arduino8266_toolchain.py index a0ac1aa5e6..26929531c9 100644 --- a/tests/unit_tests/test_arduino8266_toolchain.py +++ b/tests/unit_tests/test_arduino8266_toolchain.py @@ -180,8 +180,9 @@ def test_print_size_summary_no_app_size( ): toolchain._print_size_summary(tmp_path) out = capsys.readouterr().out - assert "RAM:" in out - assert "Flash:" not in out + # Both lines are skipped together: a RAM line without Flash would skew + # CI's memory-impact sums across builds + assert out == "" def test_print_size_summary_size_tool_failure(