mirror of
https://github.com/python-kasa/python-kasa.git
synced 2026-10-07 13:23:55 +00:00
tests: add type annotations to top-level test files (#1688)
Add type annotations (parameter types and `-> None` return types) to all top-level test functions across 22 test files. This enables mypy to check test function bodies, catching type errors that were previously hidden.
This commit is contained in:
@@ -9,6 +9,7 @@ from pathlib import Path
|
||||
from typing import NamedTuple
|
||||
|
||||
import pytest
|
||||
from pytest_mock import MockerFixture
|
||||
|
||||
from kasa.device_type import DeviceType
|
||||
from kasa.iot import IotDevice
|
||||
@@ -105,7 +106,7 @@ FIXTURE_DATA: list[FixtureInfo] = get_fixture_infos()
|
||||
|
||||
|
||||
def filter_fixtures(
|
||||
desc,
|
||||
desc: str,
|
||||
*,
|
||||
data_root_filter: str | None = None,
|
||||
protocol_filter: set[str] | None = None,
|
||||
@@ -221,7 +222,7 @@ def filter_fixtures(
|
||||
params=filter_fixtures("all fixture infos"),
|
||||
ids=idgenerator,
|
||||
)
|
||||
def fixture_info(request, mocker):
|
||||
def fixture_info(request: pytest.FixtureRequest, mocker: MockerFixture):
|
||||
"""Return raw discovery file contents as JSON. Used for discovery tests."""
|
||||
fixture_info = request.param
|
||||
fixture_data = copy.deepcopy(fixture_info.data)
|
||||
|
||||
Reference in New Issue
Block a user