From 02e9bd5d60aefbb9426959b48ff71e1f6f520221 Mon Sep 17 00:00:00 2001 From: Joost Lekkerkerker Date: Mon, 30 Nov 2026 08:01:07 +0100 Subject: [PATCH] Set up the config entry directly in Mill tests (#195366) Co-authored-by: Claude --- tests/components/mill/test_init.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/tests/components/mill/test_init.py b/tests/components/mill/test_init.py index 7914ebebcd82..7a1ec0fba53f 100644 --- a/tests/components/mill/test_init.py +++ b/tests/components/mill/test_init.py @@ -6,12 +6,10 @@ from unittest.mock import patch from pytest_homeassistant.common import MockConfigEntry from homeassistant.components import mill -from homeassistant.components.mill import DOMAIN from homeassistant.components.mill.coordinator import MillDataUpdateCoordinator from homeassistant.components.recorder import Recorder from homeassistant.config_entries import ConfigEntryState from homeassistant.core import HomeAssistant -from homeassistant.setup import async_setup_component async def test_setup_with_cloud_config( @@ -31,7 +29,7 @@ async def test_setup_with_cloud_config( patch("mill.Mill.fetch_heater_and_sensor_data", return_value={}) as mock_fetch, patch("mill.Mill.connect", return_value=True) as mock_connect, ): - assert await async_setup_component(hass, DOMAIN, {}) + assert await hass.config_entries.async_setup(entry.entry_id) assert len(mock_fetch.mock_calls) == 1 assert len(mock_connect.mock_calls) == 1 @@ -50,7 +48,7 @@ async def test_setup_with_cloud_config_fails( ) entry.add_to_hass(hass) with patch("mill.Mill.connect", return_value=False): - assert await async_setup_component(hass, DOMAIN, {}) + await hass.config_entries.async_setup(entry.entry_id) assert entry.state is ConfigEntryState.SETUP_RETRY @@ -88,7 +86,7 @@ async def test_setup_with_old_cloud_config( patch("mill.Mill.fetch_heater_and_sensor_data", return_value={}), patch("mill.Mill.connect", return_value=True) as mock_connect, ): - assert await async_setup_component(hass, DOMAIN, {}) + assert await hass.config_entries.async_setup(entry.entry_id) assert len(mock_connect.mock_calls) == 1 @@ -126,7 +124,7 @@ async def test_setup_with_local_config( }, ) as mock_connect, ): - assert await async_setup_component(hass, DOMAIN, {}) + assert await hass.config_entries.async_setup(entry.entry_id) assert len(mock_fetch.mock_calls) == 1 assert len(mock_connect.mock_calls) == 1 @@ -156,7 +154,7 @@ async def test_unload_entry(recorder_mock: Recorder, hass: HomeAssistant) -> Non return_value=True, ), ): - assert await async_setup_component(hass, DOMAIN, {}) + assert await hass.config_entries.async_setup(entry.entry_id) assert isinstance(entry.runtime_data, MillDataUpdateCoordinator)