From 9a0e8606cd0d29d2293052b2b107647278dc7951 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Mon, 20 Jul 2026 10:08:46 -1000 Subject: [PATCH] [platformio] Include cache path in invalid library error (#17692) --- esphome/platformio/library.py | 2 +- tests/unit_tests/test_platformio_library.py | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/esphome/platformio/library.py b/esphome/platformio/library.py index b3fd24c2b7..7c8566b77a 100644 --- a/esphome/platformio/library.py +++ b/esphome/platformio/library.py @@ -692,7 +692,7 @@ def convert_libraries( else: raise RuntimeError( f"Invalid PIO library {key}: missing library.json and " - "library.properties" + f"library.properties in {component.path}" ) try: diff --git a/tests/unit_tests/test_platformio_library.py b/tests/unit_tests/test_platformio_library.py index d2ca71bad6..c0a0c678db 100644 --- a/tests/unit_tests/test_platformio_library.py +++ b/tests/unit_tests/test_platformio_library.py @@ -261,15 +261,18 @@ def test_convert_libraries_raises_when_manifest_missing_after_retry( tmp_path: Path, monkeypatch: pytest.MonkeyPatch ) -> None: # If the forced re-download still yields no manifest, the error is raised - # after exactly one retry (no retry loop). + # after exactly one retry (no retry loop). The error must name the cache + # directory so users can find the broken entry instead of guessing where + # the library was unpacked. calls = _patch_download_without_manifest( monkeypatch, tmp_path, manifest_on_force=False ) - with pytest.raises(RuntimeError, match="Invalid PIO library"): + with pytest.raises(RuntimeError, match="Invalid PIO library") as excinfo: convert_libraries([Library("esphome/A", "1.0.0", None)], _backend()) assert calls == [False, True] + assert str(tmp_path / "esphome__A") in str(excinfo.value) @pytest.mark.parametrize(