mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 03:07:37 +00:00
Improve type hints in canary tests (#120305)
This commit is contained in:
parent
e3806d12f4
commit
aef2f7d707
@ -4,16 +4,19 @@ from unittest.mock import MagicMock, patch
|
|||||||
|
|
||||||
from canary.api import Api
|
from canary.api import Api
|
||||||
import pytest
|
import pytest
|
||||||
|
from typing_extensions import Generator
|
||||||
|
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(autouse=True)
|
@pytest.fixture(autouse=True)
|
||||||
def mock_ffmpeg(hass):
|
def mock_ffmpeg(hass: HomeAssistant) -> None:
|
||||||
"""Mock ffmpeg is loaded."""
|
"""Mock ffmpeg is loaded."""
|
||||||
hass.config.components.add("ffmpeg")
|
hass.config.components.add("ffmpeg")
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def canary(hass):
|
def canary() -> Generator[MagicMock]:
|
||||||
"""Mock the CanaryApi for easier testing."""
|
"""Mock the CanaryApi for easier testing."""
|
||||||
with (
|
with (
|
||||||
patch.object(Api, "login", return_value=True),
|
patch.object(Api, "login", return_value=True),
|
||||||
@ -38,7 +41,7 @@ def canary(hass):
|
|||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def canary_config_flow(hass):
|
def canary_config_flow() -> Generator[MagicMock]:
|
||||||
"""Mock the CanaryApi for easier config flow testing."""
|
"""Mock the CanaryApi for easier config flow testing."""
|
||||||
with (
|
with (
|
||||||
patch.object(Api, "login", return_value=True),
|
patch.object(Api, "login", return_value=True),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user