Improve YieldFixture typing (#117686)
This commit is contained in:
parent
26a599ad11
commit
3cd1717437
4 changed files with 12 additions and 15 deletions
|
@ -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)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue