diff --git a/tests/components/aosmith/test_sensor.py b/tests/components/aosmith/test_sensor.py index 8e6f179c088e19f83a0eeceeff137c9efc335e6b..1dc632b5e8431f540349eedf1e97d4e4d646d409 100644 --- a/tests/components/aosmith/test_sensor.py +++ b/tests/components/aosmith/test_sensor.py @@ -14,7 +14,7 @@ from tests.common import MockConfigEntry, snapshot_platform @pytest.fixture(autouse=True) -async def platforms() -> AsyncGenerator[list[str]]: +async def platforms() -> AsyncGenerator[None]: """Return the platforms to be loaded for this test.""" with patch("homeassistant.components.aosmith.PLATFORMS", [Platform.SENSOR]): yield diff --git a/tests/components/aosmith/test_water_heater.py b/tests/components/aosmith/test_water_heater.py index 3cd0de1722a94ae8932ae8ce986b1cdac014a2e8..69ad8004fc26ae24c7bc5c94257de687e89ec283 100644 --- a/tests/components/aosmith/test_water_heater.py +++ b/tests/components/aosmith/test_water_heater.py @@ -29,7 +29,7 @@ from tests.common import MockConfigEntry, snapshot_platform @pytest.fixture(autouse=True) -async def platforms() -> AsyncGenerator[list[str]]: +async def platforms() -> AsyncGenerator[None]: """Return the platforms to be loaded for this test.""" with patch("homeassistant.components.aosmith.PLATFORMS", [Platform.WATER_HEATER]): yield diff --git a/tests/components/ccm15/conftest.py b/tests/components/ccm15/conftest.py index 3bb67e92c51f484a984b4481d0b7fce96b082330..e393b2679b69bc818e4891612f886bccdf0dd7ad 100644 --- a/tests/components/ccm15/conftest.py +++ b/tests/components/ccm15/conftest.py @@ -17,7 +17,7 @@ def mock_setup_entry() -> Generator[AsyncMock]: @pytest.fixture -def ccm15_device() -> Generator[AsyncMock]: +def ccm15_device() -> Generator[None]: """Mock ccm15 device.""" ccm15_devices = { 0: CCM15SlaveDevice(bytes.fromhex("000000b0b8001b")), @@ -32,7 +32,7 @@ def ccm15_device() -> Generator[AsyncMock]: @pytest.fixture -def network_failure_ccm15_device() -> Generator[AsyncMock]: +def network_failure_ccm15_device() -> Generator[None]: """Mock empty set of ccm15 device.""" device_state = CCM15DeviceState(devices={}) with patch( diff --git a/tests/components/ccm15/test_climate.py b/tests/components/ccm15/test_climate.py index 329caafd11c1cb0c61b6ae78505c4ba6a9a46f83..785cb17c6a9e8f6f95c2d4a1cab8d73c77beca8a 100644 --- a/tests/components/ccm15/test_climate.py +++ b/tests/components/ccm15/test_climate.py @@ -1,10 +1,11 @@ """Unit test for CCM15 coordinator component.""" from datetime import timedelta -from unittest.mock import AsyncMock, patch +from unittest.mock import patch from ccm15 import CCM15DeviceState from freezegun.api import FrozenDateTimeFactory +import pytest from syrupy.assertion import SnapshotAssertion from homeassistant.components.ccm15.const import DOMAIN @@ -27,11 +28,11 @@ from homeassistant.helpers import entity_registry as er from tests.common import MockConfigEntry, async_fire_time_changed +@pytest.mark.usefixtures("ccm15_device") async def test_climate_state( hass: HomeAssistant, snapshot: SnapshotAssertion, entity_registry: er.EntityRegistry, - ccm15_device: AsyncMock, freezer: FrozenDateTimeFactory, ) -> None: """Test the coordinator.""" diff --git a/tests/components/ccm15/test_diagnostics.py b/tests/components/ccm15/test_diagnostics.py index a433591d86eaa6a8d4aa7115f9bb3b66860c2b48..f6f0d75c4e3c46cab86be3154ae0b34e0650543c 100644 --- a/tests/components/ccm15/test_diagnostics.py +++ b/tests/components/ccm15/test_diagnostics.py @@ -1,7 +1,6 @@ """Test CCM15 diagnostics.""" -from unittest.mock import AsyncMock - +import pytest from syrupy import SnapshotAssertion from homeassistant.components.ccm15.const import DOMAIN @@ -13,10 +12,10 @@ from tests.components.diagnostics import get_diagnostics_for_config_entry from tests.typing import ClientSessionGenerator +@pytest.mark.usefixtures("ccm15_device") async def test_entry_diagnostics( hass: HomeAssistant, hass_client: ClientSessionGenerator, - ccm15_device: AsyncMock, snapshot: SnapshotAssertion, ) -> None: """Test config entry diagnostics.""" diff --git a/tests/components/ccm15/test_init.py b/tests/components/ccm15/test_init.py index 3069b61f10f0debf44ef66f9c70c33e3ae4d4d50..0fb75920ad3c19aaba94a5a219783210fd843703 100644 --- a/tests/components/ccm15/test_init.py +++ b/tests/components/ccm15/test_init.py @@ -1,6 +1,6 @@ """Tests for the ccm15 component.""" -from unittest.mock import AsyncMock +import pytest from homeassistant.components.ccm15.const import DOMAIN from homeassistant.config_entries import ConfigEntryState @@ -10,7 +10,8 @@ from homeassistant.core import HomeAssistant from tests.common import MockConfigEntry -async def test_load_unload(hass: HomeAssistant, ccm15_device: AsyncMock) -> None: +@pytest.mark.usefixtures("ccm15_device") +async def test_load_unload(hass: HomeAssistant) -> None: """Test options flow.""" entry = MockConfigEntry( domain=DOMAIN, diff --git a/tests/components/flume/test_init.py b/tests/components/flume/test_init.py index 44a664259492567ff424fc0a45d6b413b71affef..85c01c1051e809975a484e2a2e6ebf1954c19db4 100644 --- a/tests/components/flume/test_init.py +++ b/tests/components/flume/test_init.py @@ -17,7 +17,7 @@ from tests.common import MockConfigEntry @pytest.fixture(autouse=True) -def platforms_fixture() -> Generator[list[str]]: +def platforms_fixture() -> Generator[None]: """Return the platforms to be loaded for this test.""" # Arbitrary platform to ensure notifications are loaded with patch("homeassistant.components.flume.PLATFORMS", [Platform.BINARY_SENSOR]): diff --git a/tests/components/hunterdouglas_powerview/conftest.py b/tests/components/hunterdouglas_powerview/conftest.py index f7adeb111b85cf2b7e82df26ac04f83446ba1733..d4433f93dcbf26ed59eede732185bdff0e02cd64 100644 --- a/tests/components/hunterdouglas_powerview/conftest.py +++ b/tests/components/hunterdouglas_powerview/conftest.py @@ -1,7 +1,7 @@ """Common fixtures for Hunter Douglas Powerview tests.""" from collections.abc import Generator -from unittest.mock import AsyncMock, MagicMock, PropertyMock, patch +from unittest.mock import AsyncMock, PropertyMock, patch from aiopvapi.resources.shade import ShadePosition import pytest @@ -29,7 +29,7 @@ def mock_hunterdouglas_hub( rooms_json: str, scenes_json: str, shades_json: str, -) -> Generator[MagicMock]: +) -> Generator[None]: """Return a mocked Powerview Hub with all data populated.""" with ( patch( diff --git a/tests/components/hunterdouglas_powerview/test_scene.py b/tests/components/hunterdouglas_powerview/test_scene.py index 9628805d0e8ca804d976477606b5b316cea7ff92..43074d55470710fad758143ecfaa7e101aaadd55 100644 --- a/tests/components/hunterdouglas_powerview/test_scene.py +++ b/tests/components/hunterdouglas_powerview/test_scene.py @@ -14,10 +14,10 @@ from .const import MOCK_MAC from tests.common import MockConfigEntry +@pytest.mark.usefixtures("mock_hunterdouglas_hub") @pytest.mark.parametrize("api_version", [1, 2, 3]) async def test_scenes( hass: HomeAssistant, - mock_hunterdouglas_hub: None, api_version: int, ) -> None: """Test the scenes.""" diff --git a/tests/components/tailwind/conftest.py b/tests/components/tailwind/conftest.py index ce49926cd2ab41850580a2ce52b196b13677a06e..ea87c1203089c267ab54971aa60cdaa398481c2c 100644 --- a/tests/components/tailwind/conftest.py +++ b/tests/components/tailwind/conftest.py @@ -3,7 +3,7 @@ from __future__ import annotations from collections.abc import Generator -from unittest.mock import AsyncMock, MagicMock, patch +from unittest.mock import MagicMock, patch from gotailwind import TailwindDeviceStatus import pytest @@ -36,7 +36,7 @@ def mock_config_entry() -> MockConfigEntry: @pytest.fixture -def mock_setup_entry() -> Generator[AsyncMock]: +def mock_setup_entry() -> Generator[None]: """Mock setting up a config entry.""" with patch( "homeassistant.components.tailwind.async_setup_entry", return_value=True diff --git a/tests/components/tuya/conftest.py b/tests/components/tuya/conftest.py index 380209fd5ef88058b98bcaaa453f969921822ffd..4fffb3ae389c19108f3f316ad7c3f9973c576771 100644 --- a/tests/components/tuya/conftest.py +++ b/tests/components/tuya/conftest.py @@ -3,7 +3,7 @@ from __future__ import annotations from collections.abc import Generator -from unittest.mock import AsyncMock, MagicMock, patch +from unittest.mock import MagicMock, patch import pytest @@ -35,7 +35,7 @@ def mock_config_entry() -> MockConfigEntry: @pytest.fixture -def mock_setup_entry() -> Generator[AsyncMock]: +def mock_setup_entry() -> Generator[None]: """Mock setting up a config entry.""" with patch("homeassistant.components.tuya.async_setup_entry", return_value=True): yield