haci-testing
Write, fix, or extend automated tests for a Home Assistant custom integration using pytest and pytest-homeassistant. Use when asked to "add tests", "write a test", "the tests fail", "improve coverage", "add a regression test", "test the config flow", "update snapshots", or when a behavioural change needs verification before it can be called done. Covers when a test is required and where it sits, the shared fixtures, mocking the API client, config flow and entity test patterns, registry assertions, syrupy snapshots, freezing time, and Home Assistant's logged deprecations. SYMPTOMS — load this if you are about to: instantiate an entity class directly instead of asserting on hass.states; redefine a fixture pytest-homeassistant provides; use time.sleep instead of async_fire_time_changed; silence a DeprecationWarning to make the suite pass; or commit a snapshot you have not read.