mirror of
https://github.com/home-assistant/core.git
synced 2025-11-09 02:49:40 +00:00
Improve YieldFixture typing (#117686)
This commit is contained in:
@@ -2,8 +2,8 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import AsyncGenerator, Awaitable, Callable, Generator
|
||||
from typing import Any, TypeVar
|
||||
from collections.abc import AsyncGenerator, Awaitable, Callable
|
||||
from typing import Any
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
@@ -24,8 +24,7 @@ CONFIG_ENTRY_DATA = {"server_url": SERVER_URL}
|
||||
|
||||
# Typing helpers
|
||||
ComponentSetup = Callable[[], Awaitable[None]]
|
||||
_T = TypeVar("_T")
|
||||
YieldFixture = Generator[_T, None, None]
|
||||
type AsyncYieldFixture[_T] = AsyncGenerator[_T, None]
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
@@ -91,7 +90,7 @@ async def rtsp_to_webrtc_client() -> None:
|
||||
@pytest.fixture
|
||||
async def setup_integration(
|
||||
hass: HomeAssistant, config_entry: MockConfigEntry
|
||||
) -> YieldFixture[ComponentSetup]:
|
||||
) -> AsyncYieldFixture[ComponentSetup]:
|
||||
"""Fixture for setting up the component."""
|
||||
config_entry.add_to_hass(hass)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user