Work from WattPlan as the source of truth.
The repository now uses the HACS-standard layout, so the integration lives at custom_components/wattplan/ at the repo root and tests import custom_components directly from the project root.
Install uv, then create a local virtualenv with the test
dependencies.
uv venv --python python3.14 .venv
. .venv/bin/activate
uv pip install --python .venv/bin/python '.[test]'Use Python 3.14.2 or newer. The pinned Home Assistant test stack currently requires that patch level.
On systems where the repo lives on a mounted or network-backed filesystem, a
repo-local .venv may be less reliable with uv than a virtualenv created on
the native local filesystem. If that affects your setup, create the venv in
your preferred local location and point the test wrapper at it.
Run tests directly from this repo:
python -m pytest testsRun the full suite from the repo:
./scripts/run_tests.shIf your virtualenv is not at the wrapper's default location, point the wrapper at it:
WATTPLAN_TEST_VENV=/path/to/venv ./scripts/run_tests.shRun only optimizer tests:
./scripts/run_tests.sh tests/optimizerRun only integration tests:
./scripts/run_tests.sh tests/integrationRun the isolated hello-world Home Assistant smoke test:
./sandbox/ha_hello_world/run.shThis smoke test is separate from the main tests/ suite. It disables pytest
plugin autoload, blocks pycares/aiodns imports inside the smoke test, and
runs from /tmp so it is less sensitive to filesystem-specific path issues.
If you want a dedicated local venv for just that smoke test, create
sandbox/ha_hello_world/.venv and point the runner at it with
WATTPLAN_HA_VENV.
Build a local HACS artifact:
python scripts/build_hacs_zip.pyBuild with an explicit label:
python scripts/build_hacs_zip.py --version-label local-devArtifacts are written to dist/.
- Keep the optimizer pure; do not add
homeassistantimports underoptimizer/. - If integration behavior changes, update integration tests in the same change.
- If workflows or release behavior change, update
README.md,docs/release.md, andAGENTS.md.