Add ClientSessionGenerator type hints in tests (#118377)

This commit is contained in:
epenet 2024-05-29 14:49:14 +02:00 committed by GitHub
parent d10362e226
commit 461ac1e0bc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
26 changed files with 127 additions and 47 deletions

View file

@ -6,6 +6,7 @@ import re
from typing import Any
from unittest.mock import patch
from aiohttp.test_utils import TestClient
from freezegun.api import FrozenDateTimeFactory
import pytest
@ -99,13 +100,17 @@ def aiohttp_client(
@pytest.fixture
async def mock_http_client(hass, aiohttp_client, frontend):
async def mock_http_client(
hass: HomeAssistant, aiohttp_client: ClientSessionGenerator, frontend
) -> TestClient:
"""Start the Home Assistant HTTP component."""
return await aiohttp_client(hass.http.app)
@pytest.fixture
async def themes_ws_client(hass, hass_ws_client, frontend_themes):
async def themes_ws_client(
hass: HomeAssistant, hass_ws_client: ClientSessionGenerator, frontend_themes
) -> TestClient:
"""Start the Home Assistant HTTP component."""
return await hass_ws_client(hass)
@ -117,7 +122,9 @@ async def ws_client(hass, hass_ws_client, frontend):
@pytest.fixture
async def mock_http_client_with_extra_js(hass, aiohttp_client, ignore_frontend_deps):
async def mock_http_client_with_extra_js(
hass: HomeAssistant, aiohttp_client: ClientSessionGenerator, ignore_frontend_deps
) -> TestClient:
"""Start the Home Assistant HTTP component."""
assert await async_setup_component(
hass,