Add HA lifecycle tests and CI
Tests / tests (push) Canceled after 0s

This commit is contained in:
buzera committed 2026-10-26 18:21:18 +02:00
1 parent cea79b6b48
commit c771bc360a
12 files changed
+378 -4

No files matched your search

+28
View File
@@ -0,0 +1,28 @@
"""Small local packaging and translation checks; not a replacement for hassfest."""
import json
from pathlib import Path
import subprocess
root = Path(__file__).resolve().parents[1]
component = root / "custom_components" / "heating_mpc"
manifest = json.loads((component / "manifest.json").read_text())
assert manifest["domain"] == "heating_mpc"
assert manifest["config_flow"] is True
assert manifest["iot_class"] == "local_polling"
assert not manifest["requirements"], "Model inference should remain dependency-free"
json.loads((root / "hacs.json").read_text())
def keys(value, prefix=()):
if not isinstance(value, dict):
return {prefix}
return set().union(*(keys(child, (*prefix, key)) for key, child in value.items()))
strings = json.loads((component / "strings.json").read_text())
for language in ("en", "ro"):
translated = json.loads((component / "translations" / f"{language}.json").read_text())
assert keys(strings) == keys(translated), f"Translation keys differ: {language}"
tracked = subprocess.check_output(["git", "ls-files", "custom_components"], cwd=root, text=True).splitlines()
assert not any("__pycache__" in path or path.endswith((".pyc", ".pyo")) for path in tracked)
print("Package metadata, translations and tracked component files passed")