From 27f05f01cf075ce6b1acb6c77e0b3ad17cfa5cbe Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Fri, 28 Aug 2026 10:04:26 -0500 Subject: [PATCH] Cover the unreadable ldgen.cmake branch --- tests/unit_tests/test_espidf_framework.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/unit_tests/test_espidf_framework.py b/tests/unit_tests/test_espidf_framework.py index dadf8717a4..5afb07cb2f 100644 --- a/tests/unit_tests/test_espidf_framework.py +++ b/tests/unit_tests/test_espidf_framework.py @@ -918,6 +918,15 @@ def test_patch_ldgen_cmake_missing_file_is_noop(tmp_path: Path) -> None: _patch_ldgen_cmake(tmp_path) # no tools/cmake/ldgen.cmake present +def test_patch_ldgen_cmake_unreadable_file_warns_and_skips( + tmp_path: Path, caplog: pytest.LogCaptureFixture +) -> None: + _write_ldgen_cmake(tmp_path, _LDGEN_CMAKE_STOCK) + with patch.object(Path, "read_text", side_effect=OSError("boom")): + _patch_ldgen_cmake(tmp_path) + assert "Could not apply the ldgen dependency patch" in caplog.text + + def test_patch_ldgen_cmake_unexpected_depends_skips( tmp_path: Path, caplog: pytest.LogCaptureFixture ) -> None: