diff --git a/tests/components/recorder/test_init.py b/tests/components/recorder/test_init.py index 207f74bc01c..fb43799b4a3 100644 --- a/tests/components/recorder/test_init.py +++ b/tests/components/recorder/test_init.py @@ -1262,7 +1262,7 @@ async def test_auto_purge_disabled( async def test_auto_statistics( hass: HomeAssistant, setup_recorder: None, - freezer, + freezer: FrozenDateTimeFactory, ) -> None: """Test periodic statistics scheduling.""" timezone = "Europe/Copenhagen" diff --git a/tests/components/recorder/test_util.py b/tests/components/recorder/test_util.py index f9682fac3a6..974e401264e 100644 --- a/tests/components/recorder/test_util.py +++ b/tests/components/recorder/test_util.py @@ -721,7 +721,7 @@ async def test_no_issue_for_mariadb_with_MDEV_25020( async def test_basic_sanity_check( - hass: HomeAssistant, setup_recorder: None, recorder_db_url + hass: HomeAssistant, setup_recorder: None, recorder_db_url: str ) -> None: """Test the basic sanity checks with a missing table.""" if recorder_db_url.startswith(("mysql://", "postgresql://")): @@ -742,7 +742,7 @@ async def test_combined_checks( hass: HomeAssistant, setup_recorder: None, caplog: pytest.LogCaptureFixture, - recorder_db_url, + recorder_db_url: str, ) -> None: """Run Checks on the open database.""" if recorder_db_url.startswith(("mysql://", "postgresql://")): @@ -831,7 +831,7 @@ async def test_end_incomplete_runs( async def test_periodic_db_cleanups( - hass: HomeAssistant, setup_recorder: None, recorder_db_url + hass: HomeAssistant, setup_recorder: None, recorder_db_url: str ) -> None: """Test periodic db cleanups.""" if recorder_db_url.startswith(("mysql://", "postgresql://")): diff --git a/tests/components/repairs/test_websocket_api.py b/tests/components/repairs/test_websocket_api.py index 846b25ae8c2..60d0364b985 100644 --- a/tests/components/repairs/test_websocket_api.py +++ b/tests/components/repairs/test_websocket_api.py @@ -432,7 +432,9 @@ async def test_step_unauth( @pytest.mark.freeze_time("2022-07-19 07:53:05") async def test_list_issues( - hass: HomeAssistant, hass_storage: dict[str, Any], hass_ws_client + hass: HomeAssistant, + hass_storage: dict[str, Any], + hass_ws_client: WebSocketGenerator, ) -> None: """Test we can list issues.""" @@ -581,7 +583,9 @@ async def test_fix_issue_aborted( @pytest.mark.freeze_time("2022-07-19 07:53:05") -async def test_get_issue_data(hass: HomeAssistant, hass_ws_client) -> None: +async def test_get_issue_data( + hass: HomeAssistant, hass_ws_client: WebSocketGenerator +) -> None: """Test we can get issue data.""" assert await async_setup_component(hass, DOMAIN, {}) diff --git a/tests/components/schedule/test_init.py b/tests/components/schedule/test_init.py index a7e8449c845..c43b2500ccb 100644 --- a/tests/components/schedule/test_init.py +++ b/tests/components/schedule/test_init.py @@ -6,6 +6,7 @@ from collections.abc import Callable, Coroutine from typing import Any from unittest.mock import patch +from freezegun.api import FrozenDateTimeFactory import pytest from homeassistant.components.schedule import STORAGE_VERSION, STORAGE_VERSION_MINOR @@ -181,7 +182,7 @@ async def test_events_one_day( hass: HomeAssistant, schedule_setup: Callable[..., Coroutine[Any, Any, bool]], caplog: pytest.LogCaptureFixture, - freezer, + freezer: FrozenDateTimeFactory, ) -> None: """Test events only during one day of the week.""" freezer.move_to("2022-08-30 13:20:00-07:00") @@ -225,7 +226,7 @@ async def test_adjacent_cross_midnight( hass: HomeAssistant, schedule_setup: Callable[..., Coroutine[Any, Any, bool]], caplog: pytest.LogCaptureFixture, - freezer, + freezer: FrozenDateTimeFactory, ) -> None: """Test adjacent events don't toggle on->off->on.""" freezer.move_to("2022-08-30 13:20:00-07:00") @@ -286,7 +287,7 @@ async def test_adjacent_within_day( hass: HomeAssistant, schedule_setup: Callable[..., Coroutine[Any, Any, bool]], caplog: pytest.LogCaptureFixture, - freezer, + freezer: FrozenDateTimeFactory, ) -> None: """Test adjacent events don't toggle on->off->on.""" freezer.move_to("2022-08-30 13:20:00-07:00") @@ -349,7 +350,7 @@ async def test_non_adjacent_within_day( hass: HomeAssistant, schedule_setup: Callable[..., Coroutine[Any, Any, bool]], caplog: pytest.LogCaptureFixture, - freezer, + freezer: FrozenDateTimeFactory, ) -> None: """Test adjacent events don't toggle on->off->on.""" freezer.move_to("2022-08-30 13:20:00-07:00") @@ -429,7 +430,7 @@ async def test_to_midnight( schedule_setup: Callable[..., Coroutine[Any, Any, bool]], caplog: pytest.LogCaptureFixture, schedule: list[dict[str, str]], - freezer, + freezer: FrozenDateTimeFactory, ) -> None: """Test time range allow to 24:00.""" freezer.move_to("2022-08-30 13:20:00-07:00") @@ -516,7 +517,7 @@ async def test_load( async def test_schedule_updates( hass: HomeAssistant, schedule_setup: Callable[..., Coroutine[Any, Any, bool]], - freezer, + freezer: FrozenDateTimeFactory, ) -> None: """Test the schedule updates when time changes.""" freezer.move_to("2022-08-10 20:10:00-07:00") @@ -678,7 +679,7 @@ async def test_ws_create( hass_ws_client: WebSocketGenerator, entity_registry: er.EntityRegistry, schedule_setup: Callable[..., Coroutine[Any, Any, bool]], - freezer, + freezer: FrozenDateTimeFactory, to: str, next_event: str, saved_to: str, diff --git a/tests/components/tag/test_event.py b/tests/components/tag/test_event.py index d3dc7f73058..e0a10455d1e 100644 --- a/tests/components/tag/test_event.py +++ b/tests/components/tag/test_event.py @@ -1,5 +1,7 @@ """Tests for the tag component.""" +from typing import Any + from freezegun.api import FrozenDateTimeFactory import pytest @@ -18,7 +20,7 @@ from tests.typing import WebSocketGenerator @pytest.fixture def storage_setup_named_tag( hass: HomeAssistant, - hass_storage, + hass_storage: dict[str, Any], ): """Storage setup for test case of named tags.""" @@ -76,7 +78,7 @@ async def test_named_tag_scanned_event( @pytest.fixture -def storage_setup_unnamed_tag(hass: HomeAssistant, hass_storage): +def storage_setup_unnamed_tag(hass: HomeAssistant, hass_storage: dict[str, Any]): """Storage setup for test case of unnamed tags.""" async def _storage(items=None): diff --git a/tests/components/tag/test_init.py b/tests/components/tag/test_init.py index 914719c8c1a..4767cc40fdf 100644 --- a/tests/components/tag/test_init.py +++ b/tests/components/tag/test_init.py @@ -1,6 +1,7 @@ """Tests for the tag component.""" import logging +from typing import Any from freezegun.api import FrozenDateTimeFactory import pytest @@ -20,7 +21,7 @@ from tests.typing import WebSocketGenerator @pytest.fixture -def storage_setup(hass: HomeAssistant, hass_storage): +def storage_setup(hass: HomeAssistant, hass_storage: dict[str, Any]): """Storage setup.""" async def _storage(items=None): diff --git a/tests/components/tag/test_trigger.py b/tests/components/tag/test_trigger.py index 613b5585670..60d45abb7b9 100644 --- a/tests/components/tag/test_trigger.py +++ b/tests/components/tag/test_trigger.py @@ -1,5 +1,7 @@ """Tests for tag triggers.""" +from typing import Any + import pytest from homeassistant.components import automation @@ -18,7 +20,7 @@ def stub_blueprint_populate_autouse(stub_blueprint_populate: None) -> None: @pytest.fixture -def tag_setup(hass: HomeAssistant, hass_storage): +def tag_setup(hass: HomeAssistant, hass_storage: dict[str, Any]): """Tag setup.""" async def _storage(items=None): diff --git a/tests/components/timer/test_init.py b/tests/components/timer/test_init.py index 0ac3eea3b8c..854ba10fe9f 100644 --- a/tests/components/timer/test_init.py +++ b/tests/components/timer/test_init.py @@ -2,6 +2,7 @@ from datetime import timedelta import logging +from typing import Any from unittest.mock import patch import pytest @@ -59,7 +60,7 @@ _LOGGER = logging.getLogger(__name__) @pytest.fixture -def storage_setup(hass: HomeAssistant, hass_storage): +def storage_setup(hass: HomeAssistant, hass_storage: dict[str, Any]): """Storage setup.""" async def _storage(items=None, config=None): diff --git a/tests/components/tod/test_binary_sensor.py b/tests/components/tod/test_binary_sensor.py index c3e13c089c5..c4b28b527cb 100644 --- a/tests/components/tod/test_binary_sensor.py +++ b/tests/components/tod/test_binary_sensor.py @@ -658,7 +658,9 @@ async def test_dst1( assert state.state == STATE_OFF -async def test_dst2(hass, freezer, hass_tz_info): +async def test_dst2( + hass: HomeAssistant, freezer: FrozenDateTimeFactory, hass_tz_info +) -> None: """Test DST when there's a time switch in the East.""" hass.config.time_zone = "CET" dt_util.set_default_time_zone(dt_util.get_time_zone("CET")) @@ -684,7 +686,9 @@ async def test_dst2(hass, freezer, hass_tz_info): assert state.state == STATE_OFF -async def test_dst3(hass, freezer, hass_tz_info): +async def test_dst3( + hass: HomeAssistant, freezer: FrozenDateTimeFactory, hass_tz_info +) -> None: """Test DST when there's a time switch forward in the West.""" hass.config.time_zone = "US/Pacific" dt_util.set_default_time_zone(dt_util.get_time_zone("US/Pacific")) @@ -712,7 +716,9 @@ async def test_dst3(hass, freezer, hass_tz_info): assert state.state == STATE_OFF -async def test_dst4(hass, freezer, hass_tz_info): +async def test_dst4( + hass: HomeAssistant, freezer: FrozenDateTimeFactory, hass_tz_info +) -> None: """Test DST when there's a time switch backward in the West.""" hass.config.time_zone = "US/Pacific" dt_util.set_default_time_zone(dt_util.get_time_zone("US/Pacific")) diff --git a/tests/components/trace/test_websocket_api.py b/tests/components/trace/test_websocket_api.py index f2cfb6a109f..91e651ba6e3 100644 --- a/tests/components/trace/test_websocket_api.py +++ b/tests/components/trace/test_websocket_api.py @@ -122,7 +122,7 @@ async def _assert_contexts(client, next_id, contexts, domain=None, item_id=None) async def test_get_trace( hass: HomeAssistant, hass_storage: dict[str, Any], - hass_ws_client, + hass_ws_client: WebSocketGenerator, domain, prefix, extra_trace_keys, @@ -425,7 +425,10 @@ async def test_get_trace( @pytest.mark.parametrize("domain", ["automation", "script"]) async def test_restore_traces( - hass: HomeAssistant, hass_storage: dict[str, Any], hass_ws_client, domain + hass: HomeAssistant, + hass_storage: dict[str, Any], + hass_ws_client: WebSocketGenerator, + domain: str, ) -> None: """Test restored traces.""" hass.set_state(CoreState.not_running) @@ -595,9 +598,9 @@ async def test_trace_overflow( async def test_restore_traces_overflow( hass: HomeAssistant, hass_storage: dict[str, Any], - hass_ws_client, - domain, - num_restored_moon_traces, + hass_ws_client: WebSocketGenerator, + domain: str, + num_restored_moon_traces: int, ) -> None: """Test restored traces are evicted first.""" hass.set_state(CoreState.not_running) @@ -675,10 +678,10 @@ async def test_restore_traces_overflow( async def test_restore_traces_late_overflow( hass: HomeAssistant, hass_storage: dict[str, Any], - hass_ws_client, - domain, - num_restored_moon_traces, - restored_run_id, + hass_ws_client: WebSocketGenerator, + domain: str, + num_restored_moon_traces: int, + restored_run_id: str, ) -> None: """Test restored traces are evicted first.""" hass.set_state(CoreState.not_running) diff --git a/tests/components/unifiprotect/test_migrate.py b/tests/components/unifiprotect/test_migrate.py index a48925d9c67..8fdf113f9db 100644 --- a/tests/components/unifiprotect/test_migrate.py +++ b/tests/components/unifiprotect/test_migrate.py @@ -23,8 +23,11 @@ from tests.typing import WebSocketGenerator async def test_deprecated_entity( - hass: HomeAssistant, ufp: MockUFPFixture, hass_ws_client, doorbell: Camera -): + hass: HomeAssistant, + ufp: MockUFPFixture, + hass_ws_client: WebSocketGenerator, + doorbell: Camera, +) -> None: """Test Deprecate entity repair does not exist by default (new installs).""" await init_entry(hass, ufp, [doorbell]) @@ -47,9 +50,9 @@ async def test_deprecated_entity_no_automations( hass: HomeAssistant, entity_registry: er.EntityRegistry, ufp: MockUFPFixture, - hass_ws_client, + hass_ws_client: WebSocketGenerator, doorbell: Camera, -): +) -> None: """Test Deprecate entity repair exists for existing installs.""" entity_registry.async_get_or_create( Platform.SWITCH, diff --git a/tests/components/upcloud/test_config_flow.py b/tests/components/upcloud/test_config_flow.py index 4ce87bf38ab..51ee8875ec3 100644 --- a/tests/components/upcloud/test_config_flow.py +++ b/tests/components/upcloud/test_config_flow.py @@ -110,7 +110,9 @@ async def test_options(hass: HomeAssistant) -> None: ) -async def test_already_configured(hass: HomeAssistant, requests_mock) -> None: +async def test_already_configured( + hass: HomeAssistant, requests_mock: requests_mock.Mocker +) -> None: """Test duplicate entry aborts and updates data.""" config_entry = MockConfigEntry( diff --git a/tests/components/zha/conftest.py b/tests/components/zha/conftest.py index 54440a0f75b..d9f335769ec 100644 --- a/tests/components/zha/conftest.py +++ b/tests/components/zha/conftest.py @@ -519,7 +519,7 @@ def network_backup() -> zigpy.backups.NetworkBackup: @pytest.fixture -def core_rs(hass_storage): +def core_rs(hass_storage: dict[str, Any]): """Core.restore_state fixture.""" def _storage(entity_id, state, attributes={}): diff --git a/tests/components/zha/test_select.py b/tests/components/zha/test_select.py index b08e077c11d..70f58ee4e6d 100644 --- a/tests/components/zha/test_select.py +++ b/tests/components/zha/test_select.py @@ -1,5 +1,6 @@ """Test ZHA select entities.""" +from typing import Any from unittest.mock import call, patch import pytest @@ -90,7 +91,7 @@ async def light(hass, zigpy_device_mock): @pytest.fixture -def core_rs(hass_storage): +def core_rs(hass_storage: dict[str, Any]): """Core.restore_state fixture.""" def _storage(entity_id, state): diff --git a/tests/components/zha/test_sensor.py b/tests/components/zha/test_sensor.py index 59da8332b27..8a9c59c587c 100644 --- a/tests/components/zha/test_sensor.py +++ b/tests/components/zha/test_sensor.py @@ -2,6 +2,7 @@ from datetime import timedelta import math +from typing import Any from unittest.mock import MagicMock, patch import pytest @@ -646,7 +647,7 @@ def hass_ms(hass: HomeAssistant): @pytest.fixture -def core_rs(hass_storage): +def core_rs(hass_storage: dict[str, Any]): """Core.restore_state fixture.""" def _storage(entity_id, uom, state): diff --git a/tests/components/zha/test_websocket_api.py b/tests/components/zha/test_websocket_api.py index 927da4ed2c0..85d849958a4 100644 --- a/tests/components/zha/test_websocket_api.py +++ b/tests/components/zha/test_websocket_api.py @@ -64,6 +64,7 @@ from .conftest import ( from .data import BASE_CUSTOM_CONFIGURATION, CONFIG_WITH_ALARM_OPTIONS from tests.common import MockConfigEntry, MockUser +from tests.typing import MockHAClientWebSocket, WebSocketGenerator IEEE_SWITCH_DEVICE = "01:2d:6f:00:0a:90:69:e7" IEEE_GROUPABLE_DEVICE = "01:2d:6f:00:0a:90:69:e8" @@ -151,7 +152,12 @@ async def device_groupable(hass, zigpy_device_mock, zha_device_joined): @pytest.fixture -async def zha_client(hass, hass_ws_client, device_switch, device_groupable): +async def zha_client( + hass: HomeAssistant, + hass_ws_client: WebSocketGenerator, + device_switch, + device_groupable, +) -> MockHAClientWebSocket: """Get ZHA WebSocket client.""" # load the ZHA API diff --git a/tests/components/zone/test_init.py b/tests/components/zone/test_init.py index fcd0c39a4f5..434ec9ccd2f 100644 --- a/tests/components/zone/test_init.py +++ b/tests/components/zone/test_init.py @@ -1,5 +1,6 @@ """Test zone component.""" +from typing import Any from unittest.mock import patch import pytest @@ -24,7 +25,7 @@ from tests.typing import WebSocketGenerator @pytest.fixture -def storage_setup(hass, hass_storage): +def storage_setup(hass: HomeAssistant, hass_storage: dict[str, Any]): """Storage setup.""" async def _storage(items=None, config=None):