Add type hints for FixtureRequest in tests (#118779)

This commit is contained in:
epenet
2024-06-04 10:37:54 +02:00
committed by GitHub
parent 16fd19f01a
commit b54a68750b
27 changed files with 67 additions and 36 deletions

View File

@@ -1,5 +1,6 @@
"""The tests for the InfluxDB component."""
from collections.abc import Generator
from dataclasses import dataclass
import datetime
from http import HTTPStatus
@@ -51,7 +52,9 @@ def mock_batch_timeout(hass, monkeypatch):
@pytest.fixture(name="mock_client")
def mock_client_fixture(request):
def mock_client_fixture(
request: pytest.FixtureRequest,
) -> Generator[MagicMock, None, None]:
"""Patch the InfluxDBClient object with mock for version under test."""
if request.param == influxdb.API_VERSION_2:
client_target = f"{INFLUX_CLIENT_PATH}V2"
@@ -63,7 +66,7 @@ def mock_client_fixture(request):
@pytest.fixture(name="get_mock_call")
def get_mock_call_fixture(request):
def get_mock_call_fixture(request: pytest.FixtureRequest):
"""Get version specific lambda to make write API call mock."""
def v2_call(body, precision):