From aef2f7d7078cf317a17bff7f17f949097137b4ae Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Mon, 24 Jun 2024 13:34:44 +0200 Subject: [PATCH] Improve type hints in canary tests (#120305) --- tests/components/canary/conftest.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/components/canary/conftest.py b/tests/components/canary/conftest.py index 336e6577ecc..583986fd483 100644 --- a/tests/components/canary/conftest.py +++ b/tests/components/canary/conftest.py @@ -4,16 +4,19 @@ from unittest.mock import MagicMock, patch from canary.api import Api import pytest +from typing_extensions import Generator + +from homeassistant.core import HomeAssistant @pytest.fixture(autouse=True) -def mock_ffmpeg(hass): +def mock_ffmpeg(hass: HomeAssistant) -> None: """Mock ffmpeg is loaded.""" hass.config.components.add("ffmpeg") @pytest.fixture -def canary(hass): +def canary() -> Generator[MagicMock]: """Mock the CanaryApi for easier testing.""" with ( patch.object(Api, "login", return_value=True), @@ -38,7 +41,7 @@ def canary(hass): @pytest.fixture -def canary_config_flow(hass): +def canary_config_flow() -> Generator[MagicMock]: """Mock the CanaryApi for easier config flow testing.""" with ( patch.object(Api, "login", return_value=True),