Skip to content
Jupiter documentation
Menu

Test and release

Set up the test environment, run the suite, read the guard tests, and cut a release that HACS offers to users.

Set up the test environment#

The tests run on Python 3.14 against Home Assistant 2026.11.2.

requirements-test.txt pins pytest-homeassistant 2026.11.2, pytest 9.0.3 and pytest-asyncio 1.4.0. pytest-homeassistant is Home Assistant's own test package. Its release number is the Home Assistant version it tests.

Run the tests#

The script runs python -m pytest -q and exits non-zero on any failure. The full suite takes about 11 minutes: the settings audit takes 6 of them.

A passing run ends with a line like this:

The 2 expected failures are simulation profiles. See Known limits of control.

Read the warnings as well as the failures. Fix a deprecation warning in the same change that shows it.

Test layout#

pytest.ini sets asyncio_mode = auto and addopts = -p no:respx. Home Assistant installs its own httpx alias before respx may load.

Guard tests#

Four groups of tests exist to stop work that looks done and does nothing.

The thermostat contract. test_room_mode_decides_which_devices_may_run in tests/ha/test_setup.py runs each mode against a hot room and a cold room. It asserts which devices receive a start command. It was added after the AC cooled a room in heat mode: the mode was stored and shown, and control never read it.

The basics. tests/ha/test_basics.py uses the room thermostat as a person does. Each test sets a mode and a target, lets a simulated room run minute by minute and reads the heater switch, the AC and the thermostat state. No test reads the coordinator. The rules it holds:

  • heat warms a room below the target and cool cools a room above it, at outdoor temperatures from 5 to 35 °C.
  • The room reaches the target within 4 hours and stays within 1 K of it.
  • A new target starts or ends a run. The thermostat shows the target you set.
  • off and a mode change end a run in the same call.
  • The heater and the AC do not run against each other at any minute, and the automatic mode does not take turns between them over a day.
  • With a window actuator, the automatic mode cools with the window on a cold day and runs the AC when the window does not help.
  • The mode and the target survive a restart. Dead room sensors turn the devices off.
  • Twelve seeded random days hold the same rules: a random mode, start and outdoor temperature, sensors with 0.15 K of noise, one restart and one target change at random minutes. The heater starts at most 36 times and the AC at most 18 times in 6 hours.

Add a case here for every fault a user reports about basic behaviour, before the fix.

The settings audit. tests/ha/test_settings_effect.py runs a scripted day twice for each setting: once with a base entry and once with the setting changed. It compares the device commands and the published data of the two runs.

test_the_scripted_day_is_repeatable runs the same entry twice and asserts equal output. Without it a difference would prove nothing. When a new setting does not show its level, extend House.day() with a phase that exercises it.

Dead code and unread keys. test_no_dead_code.py fails when a public function has no caller outside its own test file. test_published_keys.py fails when a published key is neither on a sensor nor read by the coordinator.

Build the documentation#

The pages are in docs-src/. docs/*.md is generated from them.

Commit docs-src/ and the regenerated docs/*.md together. docs/feature-matrix.md is generated by tests/ha/test_settings_effect.py from its audit table. Regenerate it with HVAC_WRITE_MATRIX=1 python -m pytest tests/ha/test_settings_effect.py -k feature_matrix. The suite fails when the page is stale.

Continuous integration#

.github/workflows/ci.yml runs on each push: the test suite on Python 3.14, hassfest and the HACS validation.

Release#

  1. Set version in custom_components/hvac_horizon/manifest.json and in docs.config.json to the same value.
  2. Rename the Unreleased heading in CHANGELOG.md to the version and the date.
  3. Check homeassistant in hacs.json. It is the minimum Home Assistant version, and it equals the pytest-homeassistant pin.
  4. Run scripts/check.sh, commit and push to main.
  5. Wait for CI to pass on the commit.
  6. Tag the commit v<version>, push the tag and publish a GitHub release with the changelog section as its notes.

HACS offers the newest release to users. A user installs it from HACS and restarts Home Assistant.

Source: belikh/hvac-horizon v0.8.0