"""Common test tools.""" import pytest from homeassistant.components.recorder.const import DATA_INSTANCE from tests.common import get_test_home_assistant, init_recorder_component @pytest.fixture def hass_recorder(): """Home Assistant fixture with in-memory recorder.""" hass = get_test_home_assistant() def setup_recorder(config=None): """Set up with params.""" init_recorder_component(hass, config) hass.start() hass.block_till_done() hass.data[DATA_INSTANCE].block_till_done() return hass yield setup_recorder hass.stop()