Fail by name on a missing libraries dir; single frameworks warning; fix a vacuous test

A framework tree without libraries/ now raises naming the path instead
of silently rerouting every bundled name to the registry, matching the
empty-bundled-dir error. check_library_data accepts framework=None to
skip the framework check (mirroring platform=None), so the backend-side
platform re-check no longer re-fires the frameworks-mismatch warning
the walk already emitted. The platform-rejection-is-debug test patched
the wrong module and asserted nothing; it now patches the backend's
import and asserts the dependency is absent from the resolved set.
This commit is contained in:
J. Nick Koston
2026-08-22 14:21:08 -05:00
parent a890527ab3
commit 557ba9953d
3 changed files with 28 additions and 11 deletions
+13 -2
View File
@@ -458,6 +458,16 @@ def test_nonplatform_rejection_warns_once_through_real_converter(
assert caplog.text.count("manifest is corrupt") == 1
def test_missing_libraries_dir_is_a_broken_install(tmp_path: Path) -> None:
"""A framework tree without libraries/ must fail by name, not silently
reroute every bundled name to the registry."""
framework = tmp_path / "framework"
framework.mkdir()
_add_library("Wire", None)
with pytest.raises(EsphomeError, match="framework install may be incomplete"):
_resolve(framework)
def test_provided_is_case_sensitive(tmp_path: Path) -> None:
"""Membership uses the exact on-disk names, so a case-insensitive
filesystem cannot add the same bundled library twice."""
@@ -595,12 +605,13 @@ def test_bundled_dependency_platform_rejection_is_debug(
with (
_emitting_converter(converted),
patch.object(
pio_library,
component,
"check_library_data",
side_effect=IncompatiblePlatform("nothing about the p-word here"),
),
):
_resolve(framework)
libs = _resolve(framework)
assert "Wire" not in [lib.name for lib in libs]
assert "Skipping dependency Wire" not in caplog.text