1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 21:06:19 +00:00

Use async_setup_recorder_instance fixture in recorder migration tests (#121050)

This commit is contained in:
Erik Montnemery
2024-07-03 15:56:05 +02:00
committed by GitHub
parent e7ffd7b9ad
commit 87f7703f3c
2 changed files with 42 additions and 65 deletions

View File

@@ -1478,14 +1478,17 @@ async def async_setup_recorder_instance(
):
async def async_setup_recorder(
hass: HomeAssistant, config: ConfigType | None = None
hass: HomeAssistant,
config: ConfigType | None = None,
*,
wait_recorder: bool = True,
) -> recorder.Recorder:
"""Setup and return recorder instance.""" # noqa: D401
await _async_init_recorder_component(hass, config, recorder_db_url)
await hass.async_block_till_done()
instance = hass.data[recorder.DATA_INSTANCE]
# The recorder's worker is not started until Home Assistant is running
if hass.state is CoreState.running:
if hass.state is CoreState.running and wait_recorder:
await async_recorder_block_till_done(hass)
return instance