Set up the config entry directly in Local calendar tests (#195365)

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
Joost Lekkerkerker
2026-11-29 12:31:49 -08:00
committed by GitHub
co-authored by Claude
parent 88b300dac8
commit 62e44fc574
2 changed files with 3 additions and 6 deletions
+1 -2
View File
@@ -15,7 +15,6 @@ from pytest_homeassistant.typing import ClientSessionGenerator, WebSocketGenerat
from homeassistant.components.local_calendar import LocalCalendarStore
from homeassistant.components.local_calendar.const import CONF_CALENDAR_NAME, DOMAIN
from homeassistant.core import HomeAssistant
from homeassistant.setup import async_setup_component
CALENDAR_NAME = "Light Schedule"
FRIENDLY_NAME = "Light Schedule"
@@ -102,7 +101,7 @@ def mock_config_entry() -> MockConfigEntry:
async def setup_integration(hass: HomeAssistant, config_entry: MockConfigEntry) -> None:
"""Set up the integration."""
config_entry.add_to_hass(hass)
assert await async_setup_component(hass, DOMAIN, {})
await hass.config_entries.async_setup(config_entry.entry_id)
await hass.async_block_till_done()
@@ -10,13 +10,11 @@ from freezegun.api import FrozenDateTimeFactory
import pytest
from pytest_homeassistant.common import MockConfigEntry, async_fire_time_changed
from homeassistant.components.local_calendar.const import DOMAIN
from homeassistant.components.local_calendar.store import LocalCalendarStore
from homeassistant.const import STATE_OFF, STATE_ON
from homeassistant.core import DOMAIN as HOMEASSISTANT_DOMAIN, HomeAssistant
from homeassistant.exceptions import HomeAssistantError
from homeassistant.helpers.template import DATE_STR_FORMAT
from homeassistant.setup import async_setup_component
from homeassistant.util import dt as dt_util
from .conftest import (
@@ -1243,7 +1241,7 @@ async def test_adjacent_events_stay_on(
config_entry.add_to_hass(hass)
with patch("homeassistant.components.calendar.SCAN_INTERVAL", timedelta(hours=1)):
assert await async_setup_component(hass, DOMAIN, {})
assert await hass.config_entries.async_setup(config_entry.entry_id)
await hass.async_block_till_done()
state = hass.states.get(TEST_ENTITY)
@@ -1331,7 +1329,7 @@ async def test_cancelled_event_does_not_turn_the_entity_on(
freezer.move_to("2026-07-29 07:50:20+00:00") # 01:50:20 in America/Regina
config_entry.add_to_hass(hass)
assert await async_setup_component(hass, DOMAIN, {})
assert await hass.config_entries.async_setup(config_entry.entry_id)
await hass.async_block_till_done()
state = hass.states.get(TEST_ENTITY)