From 1fc7a0798d727903ca78979c85d02ce0a47f439e Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Thu, 27 Aug 2026 23:50:51 -0500 Subject: [PATCH] Cover the unreadable firmware bin branch --- tests/unit_tests/test_size_summary.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/unit_tests/test_size_summary.py b/tests/unit_tests/test_size_summary.py index 1fcdc037a9..a16585efa1 100644 --- a/tests/unit_tests/test_size_summary.py +++ b/tests/unit_tests/test_size_summary.py @@ -160,6 +160,22 @@ def test_print_summary_flash_line( assert "(used 827455 bytes from 1835008 bytes)" in out +def test_print_summary_skips_flash_when_bin_unreadable( + tmp_path: Path, capsys: pytest.CaptureFixture[str] +) -> None: + """A firmware bin that can't be stat'ed skips the Flash line, not the RAM line.""" + size_json = _write_size_json(tmp_path, _esp32_size_data()) + partitions = tmp_path / "partitions.csv" + partitions.write_text( + "# name, type, subtype, offset, size, flags\n" + "app0, app, ota_0, 0x10000, 0x1C0000,\n" + ) + print_summary(size_json, partitions, tmp_path / "missing.bin") + out = capsys.readouterr().out + assert "RAM:" in out + assert "Flash:" not in out + + def test_print_summary_skips_flash_without_bin( tmp_path: Path, capsys: pytest.CaptureFixture[str] ) -> None: