diff --git a/tests/components/harmony/test_remote.py b/tests/components/harmony/test_remote.py index c0ec2235b84..8f488f9bf0d 100644 --- a/tests/components/harmony/test_remote.py +++ b/tests/components/harmony/test_remote.py @@ -1,6 +1,7 @@ """Test the Logitech Harmony Hub remote.""" from datetime import timedelta +from typing import Any from aioharmony.const import SendCommandDevice @@ -387,7 +388,9 @@ async def test_sync( mock_write_config.assert_called() -async def _send_commands_and_wait(hass, service_data): +async def _send_commands_and_wait( + hass: HomeAssistant, service_data: dict[str, Any] +) -> None: await hass.services.async_call( REMOTE_DOMAIN, SERVICE_SEND_COMMAND, diff --git a/tests/components/harmony/test_select.py b/tests/components/harmony/test_select.py index 2568feb1412..1451f146b98 100644 --- a/tests/components/harmony/test_select.py +++ b/tests/components/harmony/test_select.py @@ -91,7 +91,9 @@ async def test_select_option( assert hass.states.is_state(ENTITY_SELECT, "power_off") -async def _select_option_and_wait(hass, entity, option): +async def _select_option_and_wait( + hass: HomeAssistant, entity: str, option: str +) -> None: await hass.services.async_call( SELECT_DOMAIN, SERVICE_SELECT_OPTION, diff --git a/tests/components/heos/test_media_player.py b/tests/components/heos/test_media_player.py index 19f7ec74daf..089fa1cceea 100644 --- a/tests/components/heos/test_media_player.py +++ b/tests/components/heos/test_media_player.py @@ -1,6 +1,7 @@ """Tests for the Heos Media Player platform.""" import asyncio +from typing import Any from pyheos import CommandFailedError, const from pyheos.error import HeosError @@ -58,8 +59,12 @@ from homeassistant.helpers import device_registry as dr, entity_registry as er from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.setup import async_setup_component +from tests.common import MockConfigEntry -async def setup_platform(hass, config_entry, config): + +async def setup_platform( + hass: HomeAssistant, config_entry: MockConfigEntry, config: dict[str, Any] +) -> None: """Set up the media player platform for testing.""" config_entry.add_to_hass(hass) assert await async_setup_component(hass, DOMAIN, config) diff --git a/tests/components/heos/test_services.py b/tests/components/heos/test_services.py index 2d812eb83ab..d8b8b5038b0 100644 --- a/tests/components/heos/test_services.py +++ b/tests/components/heos/test_services.py @@ -13,8 +13,10 @@ from homeassistant.components.heos.const import ( from homeassistant.core import HomeAssistant from homeassistant.setup import async_setup_component +from tests.common import MockConfigEntry -async def setup_component(hass, config_entry): + +async def setup_component(hass: HomeAssistant, config_entry: MockConfigEntry) -> None: """Set up the component for testing.""" config_entry.add_to_hass(hass) assert await async_setup_component(hass, DOMAIN, {}) diff --git a/tests/components/homeassistant_hardware/conftest.py b/tests/components/homeassistant_hardware/conftest.py index b62ccaf855b..c495b5132e0 100644 --- a/tests/components/homeassistant_hardware/conftest.py +++ b/tests/components/homeassistant_hardware/conftest.py @@ -6,6 +6,8 @@ from unittest.mock import AsyncMock, MagicMock, patch import pytest +from homeassistant.core import HomeAssistant + @pytest.fixture(autouse=True) def mock_zha_config_flow_setup() -> Generator[None]: @@ -122,7 +124,7 @@ def set_addon_options_fixture(): def install_addon_side_effect_fixture(addon_store_info, addon_info): """Return the install add-on side effect.""" - async def install_addon(hass, slug): + async def install_addon(hass: HomeAssistant, slug: str) -> None: """Mock install add-on.""" addon_store_info.return_value = { "installed": "1.0.0", diff --git a/tests/components/homeassistant_sky_connect/conftest.py b/tests/components/homeassistant_sky_connect/conftest.py index 69b0901aadf..e93b90c4c7c 100644 --- a/tests/components/homeassistant_sky_connect/conftest.py +++ b/tests/components/homeassistant_sky_connect/conftest.py @@ -5,6 +5,8 @@ from unittest.mock import AsyncMock, MagicMock, patch import pytest +from homeassistant.core import HomeAssistant + @pytest.fixture(name="mock_usb_serial_by_id", autouse=True) def mock_usb_serial_by_id_fixture() -> Generator[MagicMock]: @@ -122,7 +124,7 @@ def set_addon_options_fixture(): def install_addon_side_effect_fixture(addon_store_info, addon_info): """Return the install add-on side effect.""" - async def install_addon(hass, slug): + async def install_addon(hass: HomeAssistant, slug: str) -> None: """Mock install add-on.""" addon_store_info.return_value = { "installed": "1.0.0", diff --git a/tests/components/homeassistant_yellow/conftest.py b/tests/components/homeassistant_yellow/conftest.py index 0077fb27058..9882d7613d5 100644 --- a/tests/components/homeassistant_yellow/conftest.py +++ b/tests/components/homeassistant_yellow/conftest.py @@ -6,6 +6,8 @@ from unittest.mock import AsyncMock, MagicMock, patch import pytest +from homeassistant.core import HomeAssistant + @pytest.fixture(autouse=True) def mock_zha_config_flow_setup() -> Generator[None]: @@ -122,7 +124,7 @@ def set_addon_options_fixture(): def install_addon_side_effect_fixture(addon_store_info, addon_info): """Return the install add-on side effect.""" - async def install_addon(hass, slug): + async def install_addon(hass: HomeAssistant, slug: str) -> None: """Mock install add-on.""" addon_store_info.return_value = { "installed": "1.0.0", diff --git a/tests/components/html5/test_notify.py b/tests/components/html5/test_notify.py index f54ec9fa8f7..42ca6067418 100644 --- a/tests/components/html5/test_notify.py +++ b/tests/components/html5/test_notify.py @@ -2,9 +2,11 @@ from http import HTTPStatus import json +from typing import Any from unittest.mock import mock_open, patch from aiohttp.hdrs import AUTHORIZATION +from aiohttp.test_utils import TestClient import homeassistant.components.html5.notify as html5 from homeassistant.core import HomeAssistant @@ -69,7 +71,11 @@ REGISTER_URL = "/api/notify.html5" PUBLISH_URL = "/api/notify.html5/callback" -async def mock_client(hass, hass_client, registrations=None): +async def mock_client( + hass: HomeAssistant, + hass_client: ClientSessionGenerator, + registrations: dict[str, Any] | None = None, +) -> TestClient: """Create a test client for HTML5 views.""" if registrations is None: registrations = {} diff --git a/tests/components/http/test_auth.py b/tests/components/http/test_auth.py index 7f29f8a4b9f..76c512c9686 100644 --- a/tests/components/http/test_auth.py +++ b/tests/components/http/test_auth.py @@ -4,6 +4,7 @@ from datetime import timedelta from http import HTTPStatus from ipaddress import ip_network import logging +from typing import Any from unittest.mock import Mock, patch from aiohttp import BasicAuth, web @@ -476,7 +477,11 @@ async def test_auth_access_signed_path_via_websocket( @websocket_api.websocket_command({"type": "diagnostics/list"}) @callback - def get_signed_path(hass, connection, msg): + def get_signed_path( + hass: HomeAssistant, + connection: websocket_api.ActiveConnection, + msg: dict[str, Any], + ) -> None: connection.send_result( msg["id"], {"path": async_sign_path(hass, "/", timedelta(seconds=5))} )