Skip to content

Commit fa1ac22

Browse files
SantaFoxclaude
andcommitted
Spin up an in-memory recorder in test conftest
The integration declares a hard dependency on the recorder for long-term-statistics imports; without setting one up in tests, config_entries.async_setup fails with 'Could not setup dependencies: recorder' and 14/24 of our HA tests blow up. PHACC's recorder_mock fixture provides an in-memory SQLite recorder, but it asserts that the hass fixture has not been set up yet — so we fold it into the existing autouse alongside enable_custom_integrations and put it first in the parameter list to control the load order. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent be24751 commit fa1ac22

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

tests/conftest.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,14 @@
2626

2727

2828
@pytest.fixture(autouse=True)
29-
def auto_enable_custom_integrations(enable_custom_integrations):
30-
"""Make custom_components/eac_cyprus loadable by HA in tests."""
29+
def auto_enable_custom_integrations(recorder_mock, enable_custom_integrations):
30+
"""Make custom_components/eac_cyprus loadable + spin up an in-memory recorder.
31+
32+
The order matters: ``recorder_mock`` must be requested *before* the ``hass``
33+
fixture is set up (``enable_custom_integrations`` triggers hass), otherwise
34+
PHACC asserts. The recorder is needed because the integration now declares
35+
a hard dependency on it for long-term-statistics imports.
36+
"""
3137
yield
3238

3339

0 commit comments

Comments
 (0)