Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert history tests to use async API #116447

Merged
merged 6 commits into from
May 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 14 additions & 7 deletions tests/components/history/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,24 @@
import pytest

from homeassistant.components import history
from homeassistant.components.recorder import Recorder
from homeassistant.const import CONF_DOMAINS, CONF_ENTITIES, CONF_EXCLUDE, CONF_INCLUDE
from homeassistant.setup import setup_component
from homeassistant.core import HomeAssistant
from homeassistant.setup import async_setup_component

from tests.typing import RecorderInstanceGenerator


@pytest.fixture
def hass_history(hass_recorder):
"""Home Assistant fixture with history."""
hass = hass_recorder()
async def mock_recorder_before_hass(
async_setup_recorder_instance: RecorderInstanceGenerator,
) -> None:
"""Set up recorder."""


@pytest.fixture
async def hass_history(hass: HomeAssistant, recorder_mock: Recorder) -> None:
"""Home Assistant fixture with history."""
config = history.CONFIG_SCHEMA(
{
history.DOMAIN: {
Expand All @@ -26,6 +35,4 @@ def hass_history(hass_recorder):
}
}
)
assert setup_component(hass, history.DOMAIN, config)

return hass
assert await async_setup_component(hass, history.DOMAIN, config)