Keep the top-level suppression total and honest

The check guards URL-ish names before _node_key (a malformed entry
belongs to the drop warning, not a RuntimeError) and matches against
top_level_keys so the message says exactly what it verifies; a
transitive-only node can still fail compatibility later and must not
suppress the drop report.
This commit is contained in:
J. Nick Koston
2026-08-22 10:03:43 -05:00
parent a48fbd1cd1
commit 735d4076c1
2 changed files with 18 additions and 1 deletions
+4 -1
View File
@@ -994,7 +994,10 @@ def convert_libraries(
dep_name = dependency.get("name")
if (
isinstance(dep_name, str)
and _node_key(dep_name, None, None)[0] in nodes
# _node_key raises for a malformed URL-ish name; that
# entry belongs to the warning below, not a traceback
and "://" not in dep_name
and _node_key(dep_name, None, None)[0] in top_level_keys
):
# Already requested top-level: present in the build, not
# a drop (a false warning teaches users to ignore the
@@ -665,3 +665,17 @@ def test_versionless_dependency_requested_top_level_stays_quiet(
_backend(),
)
assert "has no version to resolve" not in caplog.text
def test_versionless_url_ish_dependency_name_warns_cleanly(
tmp_path, monkeypatch, caplog: pytest.LogCaptureFixture
) -> None:
"""A malformed URL-ish dependency name falls to the drop warning, never
a RuntimeError out of the key parser."""
_patch_download_with_manifests(
monkeypatch,
tmp_path,
{"esphome/A": {"name": "A", "dependencies": [{"name": "file://"}]}},
)
convert_libraries([Library("esphome/A", None, None)], _backend())
assert "'file://' of esphome/A has no version to resolve" in caplog.text