mirror of
https://github.com/esphome/esphome.git
synced 2026-08-26 16:10:29 +00:00
Keep the missing-manifest diagnostic at debug
The legacy manifest-less layout is legal and the 3.1.2 core ships one such library (FSTools), so the warning would be unactionable noise; a test now pins the level.
This commit is contained in:
@@ -267,9 +267,10 @@ def _bundled_library(framework_path: Path, name: str) -> ArduinoLibrary:
|
||||
elif (manifest := lib_dir / "library.properties").is_file():
|
||||
data = parse_library_properties(manifest)
|
||||
else:
|
||||
# Visible: core libraries all ship a manifest, so an absent one
|
||||
# most likely means a torn framework extraction
|
||||
_LOGGER.warning("Bundled library %s has no manifest; using defaults", name)
|
||||
# Debug, not warning: the legacy manifest-less layout is legal and
|
||||
# the 3.1.2 core ships one such library (FSTools), so a warning
|
||||
# would be unactionable noise on every build using it
|
||||
_LOGGER.debug("Bundled library %s has no manifest; using defaults", name)
|
||||
data = {}
|
||||
if isinstance(data, dict):
|
||||
# Bundled manifest deps are never walked; make the skip visible
|
||||
|
||||
@@ -4,6 +4,7 @@ from __future__ import annotations
|
||||
|
||||
from contextlib import contextmanager
|
||||
import json
|
||||
import logging
|
||||
from pathlib import Path
|
||||
from unittest.mock import patch
|
||||
|
||||
@@ -900,6 +901,18 @@ def test_bundled_library_non_dict_manifest_skips_probes_and_raises(
|
||||
component._bundled_library(framework, "Wire")
|
||||
|
||||
|
||||
def test_bundled_missing_manifest_is_debug_only(
|
||||
tmp_path: Path, caplog: pytest.LogCaptureFixture
|
||||
) -> None:
|
||||
"""The legacy manifest-less layout is legal (the core ships FSTools
|
||||
without one), so the diagnostic must stay below warning level."""
|
||||
framework = _make_framework(tmp_path)
|
||||
with caplog.at_level(logging.DEBUG):
|
||||
component._bundled_library(framework, "Wire")
|
||||
record = next(r for r in caplog.records if "has no manifest" in r.message)
|
||||
assert record.levelno == logging.DEBUG
|
||||
|
||||
|
||||
def test_bundled_corrupt_library_json_fails_by_name(tmp_path: Path) -> None:
|
||||
"""A truncated bundled library.json fails with the library name and the
|
||||
clean-all hint, not a raw JSONDecodeError."""
|
||||
|
||||
Reference in New Issue
Block a user