1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-04 04:12:23 +01:00

Fix vscode validation not showing error squiggles (#8500)

Co-authored-by: J. Nick Koston <nick@koston.org>
This commit is contained in:
Guillermo Ruffino
2025-04-15 16:52:07 -03:00
committed by Jesse Hills
parent cb0a87c1f9
commit a7fd6dc382
6 changed files with 247 additions and 90 deletions

View File

@@ -42,3 +42,23 @@ def test_loading_a_missing_file(fixture_path):
yaml_util.load_yaml(yaml_file)
except EsphomeError as err:
assert "missing.yaml" in str(err)
def test_parsing_with_custom_loader(fixture_path):
"""Test custom loader used for vscode connection
Default loader is tested in test_include_with_vars
"""
yaml_file = fixture_path / "yaml_util" / "includetest.yaml"
loader_calls = []
def custom_loader(fname):
loader_calls.append(fname)
with open(yaml_file, encoding="utf-8") as f_handle:
yaml_util.parse_yaml(yaml_file, f_handle, custom_loader)
assert len(loader_calls) == 3
assert loader_calls[0].endswith("includes/included.yaml")
assert loader_calls[1].endswith("includes/list.yaml")
assert loader_calls[2].endswith("includes/scalar.yaml")