diff --git a/tests/components/apsystems/conftest.py b/tests/components/apsystems/conftest.py index 0fc1fb183a8..682086be380 100644 --- a/tests/components/apsystems/conftest.py +++ b/tests/components/apsystems/conftest.py @@ -1,7 +1,7 @@ """Common fixtures for the APsystems Local API tests.""" from collections.abc import Generator -from unittest.mock import AsyncMock, patch +from unittest.mock import AsyncMock, MagicMock, patch from APsystemsEZ1 import ReturnDeviceInfo, ReturnOutputData import pytest @@ -23,7 +23,7 @@ def mock_setup_entry() -> Generator[AsyncMock]: @pytest.fixture -def mock_apsystems() -> Generator[AsyncMock, None, None]: +def mock_apsystems() -> Generator[MagicMock]: """Mock APSystems lib.""" with ( patch( diff --git a/tests/components/aquacell/conftest.py b/tests/components/aquacell/conftest.py index db27f51dc03..f5a741ceed8 100644 --- a/tests/components/aquacell/conftest.py +++ b/tests/components/aquacell/conftest.py @@ -2,7 +2,7 @@ from collections.abc import Generator from datetime import datetime -from unittest.mock import AsyncMock, patch +from unittest.mock import AsyncMock, MagicMock, patch from aioaquacell import AquacellApi, Softener import pytest @@ -19,7 +19,7 @@ from tests.common import MockConfigEntry, load_json_array_fixture @pytest.fixture -def mock_setup_entry() -> Generator[AsyncMock, None, None]: +def mock_setup_entry() -> Generator[AsyncMock]: """Override async_setup_entry.""" with patch( "homeassistant.components.aquacell.async_setup_entry", return_value=True @@ -28,7 +28,7 @@ def mock_setup_entry() -> Generator[AsyncMock, None, None]: @pytest.fixture -def mock_aquacell_api() -> Generator[AsyncMock, None, None]: +def mock_aquacell_api() -> Generator[MagicMock]: """Build a fixture for the Aquacell API that authenticates successfully and returns a single softener.""" with ( patch( diff --git a/tests/components/brother/conftest.py b/tests/components/brother/conftest.py index ec6120db5f5..de22158da00 100644 --- a/tests/components/brother/conftest.py +++ b/tests/components/brother/conftest.py @@ -2,7 +2,7 @@ from collections.abc import Generator from datetime import UTC, datetime -from unittest.mock import AsyncMock, patch +from unittest.mock import AsyncMock, MagicMock, patch from brother import BrotherSensors import pytest @@ -87,7 +87,7 @@ def mock_setup_entry() -> Generator[AsyncMock]: @pytest.fixture -def mock_unload_entry() -> Generator[AsyncMock, None, None]: +def mock_unload_entry() -> Generator[AsyncMock]: """Override async_unload_entry.""" with patch( "homeassistant.components.brother.async_unload_entry", return_value=True @@ -96,7 +96,7 @@ def mock_unload_entry() -> Generator[AsyncMock, None, None]: @pytest.fixture -def mock_brother_client() -> Generator[AsyncMock, None, None]: +def mock_brother_client() -> Generator[MagicMock]: """Mock Brother client.""" with ( patch("homeassistant.components.brother.Brother", autospec=True) as mock_client, diff --git a/tests/components/ecovacs/test_services.py b/tests/components/ecovacs/test_services.py index 973c63782ec..19e8237be03 100644 --- a/tests/components/ecovacs/test_services.py +++ b/tests/components/ecovacs/test_services.py @@ -16,9 +16,7 @@ pytestmark = [pytest.mark.usefixtures("init_integration")] @pytest.fixture -def mock_device_execute_response( - data: dict[str, Any], -) -> Generator[dict[str, Any], None, None]: +def mock_device_execute_response(data: dict[str, Any]) -> Generator[dict[str, Any]]: """Mock the device execute function response.""" response = { diff --git a/tests/components/kitchen_sink/test_config_flow.py b/tests/components/kitchen_sink/test_config_flow.py index 290167196cd..5f163d1342e 100644 --- a/tests/components/kitchen_sink/test_config_flow.py +++ b/tests/components/kitchen_sink/test_config_flow.py @@ -1,6 +1,6 @@ """Test the Everything but the Kitchen Sink config flow.""" -from collections.abc import AsyncGenerator +from collections.abc import Generator from unittest.mock import patch import pytest @@ -15,7 +15,7 @@ from tests.common import MockConfigEntry @pytest.fixture -async def no_platforms() -> AsyncGenerator[None, None]: +def no_platforms() -> Generator[None]: """Don't enable any platforms.""" with patch( "homeassistant.components.kitchen_sink.COMPONENTS_WITH_DEMO_PLATFORM", diff --git a/tests/components/mpd/conftest.py b/tests/components/mpd/conftest.py index 818f085decc..a73a529cd0b 100644 --- a/tests/components/mpd/conftest.py +++ b/tests/components/mpd/conftest.py @@ -1,7 +1,7 @@ """Fixtures for Music Player Daemon integration tests.""" from collections.abc import Generator -from unittest.mock import AsyncMock, patch +from unittest.mock import AsyncMock, MagicMock, patch import pytest @@ -22,7 +22,7 @@ def mock_config_entry() -> MockConfigEntry: @pytest.fixture -def mock_setup_entry() -> Generator[AsyncMock, None, None]: +def mock_setup_entry() -> Generator[AsyncMock]: """Mock setting up a config entry.""" with patch( "homeassistant.components.mpd.async_setup_entry", return_value=True @@ -31,7 +31,7 @@ def mock_setup_entry() -> Generator[AsyncMock, None, None]: @pytest.fixture -def mock_mpd_client() -> Generator[AsyncMock, None, None]: +def mock_mpd_client() -> Generator[MagicMock]: """Return a mock for Music Player Daemon client.""" with patch( diff --git a/tests/components/otp/conftest.py b/tests/components/otp/conftest.py index 7443d772c69..7926be1e48e 100644 --- a/tests/components/otp/conftest.py +++ b/tests/components/otp/conftest.py @@ -14,7 +14,7 @@ from tests.common import MockConfigEntry @pytest.fixture -def mock_setup_entry() -> Generator[AsyncMock, None, None]: +def mock_setup_entry() -> Generator[AsyncMock]: """Override async_setup_entry.""" with patch( "homeassistant.components.otp.async_setup_entry", return_value=True @@ -23,7 +23,7 @@ def mock_setup_entry() -> Generator[AsyncMock, None, None]: @pytest.fixture -def mock_pyotp() -> Generator[MagicMock, None, None]: +def mock_pyotp() -> Generator[MagicMock]: """Mock a pyotp.""" with ( patch( diff --git a/tests/components/pyload/conftest.py b/tests/components/pyload/conftest.py index 1d7b11567c7..c0f181396ab 100644 --- a/tests/components/pyload/conftest.py +++ b/tests/components/pyload/conftest.py @@ -1,7 +1,7 @@ """Fixtures for pyLoad integration tests.""" from collections.abc import Generator -from unittest.mock import AsyncMock, patch +from unittest.mock import AsyncMock, MagicMock, patch from pyloadapi.types import LoginResponse, StatusServerResponse import pytest @@ -72,7 +72,7 @@ def pyload_config() -> ConfigType: @pytest.fixture -def mock_pyloadapi() -> Generator[AsyncMock, None, None]: +def mock_pyloadapi() -> Generator[MagicMock]: """Mock PyLoadAPI.""" with ( patch( diff --git a/tests/components/pyload/test_button.py b/tests/components/pyload/test_button.py index 53f592374ba..9a2f480bede 100644 --- a/tests/components/pyload/test_button.py +++ b/tests/components/pyload/test_button.py @@ -1,6 +1,6 @@ """The tests for the button component.""" -from collections.abc import AsyncGenerator +from collections.abc import Generator from unittest.mock import AsyncMock, call, patch from pyloadapi import CannotConnect, InvalidAuth @@ -26,7 +26,7 @@ API_CALL = { @pytest.fixture(autouse=True) -async def button_only() -> AsyncGenerator[None, None]: +def button_only() -> Generator[None]: """Enable only the button platform.""" with patch( "homeassistant.components.pyload.PLATFORMS", diff --git a/tests/components/pyload/test_sensor.py b/tests/components/pyload/test_sensor.py index a44c9c8bf91..8eccda07fa7 100644 --- a/tests/components/pyload/test_sensor.py +++ b/tests/components/pyload/test_sensor.py @@ -1,6 +1,6 @@ """Tests for the pyLoad Sensors.""" -from collections.abc import AsyncGenerator +from collections.abc import Generator from unittest.mock import AsyncMock, patch from freezegun.api import FrozenDateTimeFactory @@ -22,7 +22,7 @@ from tests.common import MockConfigEntry, async_fire_time_changed, snapshot_plat @pytest.fixture(autouse=True) -async def sensor_only() -> AsyncGenerator[None, None]: +def sensor_only() -> Generator[None]: """Enable only the sensor platform.""" with patch( "homeassistant.components.pyload.PLATFORMS", diff --git a/tests/components/pyload/test_switch.py b/tests/components/pyload/test_switch.py index 8e99cb00cfe..493dbd8c0da 100644 --- a/tests/components/pyload/test_switch.py +++ b/tests/components/pyload/test_switch.py @@ -1,6 +1,6 @@ """Tests for the pyLoad Switches.""" -from collections.abc import AsyncGenerator +from collections.abc import Generator from unittest.mock import AsyncMock, call, patch from pyloadapi import CannotConnect, InvalidAuth @@ -38,7 +38,7 @@ API_CALL = { @pytest.fixture(autouse=True) -async def switch_only() -> AsyncGenerator[None, None]: +def switch_only() -> Generator[None]: """Enable only the switch platform.""" with patch( "homeassistant.components.pyload.PLATFORMS", diff --git a/tests/components/solarlog/conftest.py b/tests/components/solarlog/conftest.py index 08340487d99..86cdc870cde 100644 --- a/tests/components/solarlog/conftest.py +++ b/tests/components/solarlog/conftest.py @@ -60,7 +60,7 @@ def mock_solarlog_connector(): @pytest.fixture -def mock_setup_entry() -> Generator[AsyncMock, None, None]: +def mock_setup_entry() -> Generator[AsyncMock]: """Override async_setup_entry.""" with patch( "homeassistant.components.solarlog.async_setup_entry", return_value=True