From 411630429d2e3e003867551e0d57bb5c538d27ee Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Thu, 4 Jul 2024 16:27:57 +0200 Subject: [PATCH] Improve type hints in habitica tests (#121212) --- tests/components/habitica/test_init.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/tests/components/habitica/test_init.py b/tests/components/habitica/test_init.py index 24c55c473b9..5dbff3b71e8 100644 --- a/tests/components/habitica/test_init.py +++ b/tests/components/habitica/test_init.py @@ -14,7 +14,7 @@ from homeassistant.components.habitica.const import ( SERVICE_API_CALL, ) from homeassistant.const import ATTR_NAME -from homeassistant.core import HomeAssistant +from homeassistant.core import Event, HomeAssistant from tests.common import MockConfigEntry, async_capture_events from tests.test_util.aiohttp import AiohttpClientMocker @@ -24,13 +24,13 @@ TEST_USER_NAME = "test_user" @pytest.fixture -def capture_api_call_success(hass): +def capture_api_call_success(hass: HomeAssistant) -> list[Event]: """Capture api_call events.""" return async_capture_events(hass, EVENT_API_CALL_SUCCESS) @pytest.fixture -def habitica_entry(hass): +def habitica_entry(hass: HomeAssistant) -> MockConfigEntry: """Test entry for the following tests.""" entry = MockConfigEntry( domain=DOMAIN, @@ -98,8 +98,9 @@ def common_requests(aioclient_mock: AiohttpClientMocker) -> AiohttpClientMocker: return aioclient_mock +@pytest.mark.usefixtures("common_requests") async def test_entry_setup_unload( - hass: HomeAssistant, habitica_entry, common_requests + hass: HomeAssistant, habitica_entry: MockConfigEntry ) -> None: """Test integration setup and unload.""" assert await hass.config_entries.async_setup(habitica_entry.entry_id) @@ -112,8 +113,11 @@ async def test_entry_setup_unload( assert not hass.services.has_service(DOMAIN, SERVICE_API_CALL) +@pytest.mark.usefixtures("common_requests") async def test_service_call( - hass: HomeAssistant, habitica_entry, common_requests, capture_api_call_success + hass: HomeAssistant, + habitica_entry: MockConfigEntry, + capture_api_call_success: list[Event], ) -> None: """Test integration setup, service call and unload."""