[ci] Skip YAML anchor keys in integration fixture component extraction (#14670)

This commit is contained in:
J. Nick Koston
2026-03-09 12:54:56 -10:00
committed by GitHub
parent dadbdd0f7b
commit d6ce5dda81
2 changed files with 28 additions and 2 deletions
+4 -2
View File
@@ -705,8 +705,10 @@ def get_components_from_integration_fixtures() -> set[str]:
if not config:
continue
# Add all top-level component keys
components.update(config.keys())
# Add all top-level component keys (skip YAML anchor keys starting with '.')
components.update(
k for k in config if isinstance(k, str) and not k.startswith(".")
)
# Add platform components (e.g., output.template)
for value in config.values():
+24
View File
@@ -1057,6 +1057,30 @@ def test_get_components_from_integration_fixtures() -> None:
assert components == expected_components
def test_get_components_from_integration_fixtures_skips_yaml_anchors() -> None:
"""Test that YAML anchor keys (starting with '.') are excluded."""
yaml_content = {
"sensor": [{"platform": "template", "name": "test"}],
"esphome": {"name": "test"},
".sensor_filters": {"filters": [{"timeout": "50ms"}]},
".binary_filters": {"filters": [{"settle": "50ms"}]},
}
mock_yaml_file = Mock()
with (
patch("pathlib.Path.glob") as mock_glob,
patch("esphome.yaml_util.load_yaml", return_value=yaml_content),
):
mock_glob.return_value = [mock_yaml_file]
components = helpers.get_components_from_integration_fixtures()
assert ".sensor_filters" not in components
assert ".binary_filters" not in components
assert components == {"sensor", "esphome", "template"}
@pytest.mark.parametrize(
"output,expected",
[