1
0
mirror of https://github.com/esphome/esphome.git synced 2026-02-08 08:41:59 +00:00

some more tests

This commit is contained in:
J. Nick Koston
2026-02-06 16:12:22 +01:00
parent 38b6746807
commit 5a711e455a
2 changed files with 22 additions and 0 deletions

View File

@@ -43,6 +43,7 @@ _LOGGER = logging.getLogger(__name__)
SECRET_YAML = "secrets.yaml"
_SECRET_CACHE = {}
_SECRET_VALUES = {}
# Not thread-safe — config processing is single-threaded today.
_load_listeners: list[Callable[[Path], None]] = []

View File

@@ -761,6 +761,27 @@ def test_discover_files_external_components_local(tmp_path: Path) -> None:
assert "components/my_comp/sensor.py" in paths
def test_discover_files_external_components_skips_pycache(tmp_path: Path) -> None:
"""__pycache__ directories inside local external_components are excluded."""
_setup_config_dir(
tmp_path,
files={
"components/my_comp/__init__.py": "# comp",
"components/my_comp/__pycache__/module.cpython-313.pyc": "bytecode",
},
)
config: dict[str, Any] = {
"external_components": [{"source": {"type": "local", "path": "components"}}],
}
creator = ConfigBundleCreator(config)
files = creator.discover_files()
paths = [f.path for f in files]
assert "components/my_comp/__init__.py" in paths
assert not any("__pycache__" in p for p in paths)
def test_discover_files_external_components_non_dict_source(tmp_path: Path) -> None:
"""external_components with string source (e.g. github shorthand) is skipped."""
_setup_config_dir(tmp_path)