1 parent
cea79b6b48
commit
c771bc360a
12 files changed
+378
-4
No files matched your search
@@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
# Run with Python 3.13 and requirements-test.txt installed.
|
||||
set -eu
|
||||
# A transitive HA test dependency otherwise fetches metadata on import.
|
||||
export LITELLM_LOCAL_MODEL_COST_MAP=True
|
||||
python -m pip check
|
||||
python -m unittest discover -s tests -v
|
||||
python -m pytest tests/ha -q
|
||||
python -m compileall -q custom_components/heating_mpc
|
||||
python scripts/validate_package.py
|
||||
git diff --check
|
||||
@@ -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")
|
||||
Reference in new issue
Block a user