From 3ac0fa53c8b50b17baa8936472719cb1d69a8c03 Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Tue, 4 Jun 2024 11:49:21 +0200 Subject: [PATCH] Cleanup unused FixtureRequest in tests (#118780) --- tests/components/hassio/test_sensor.py | 2 +- tests/components/homekit_controller/conftest.py | 4 +++- tests/components/ipma/test_config_flow.py | 3 ++- tests/components/knx/conftest.py | 2 +- tests/components/lametric/conftest.py | 2 +- tests/components/nest/conftest.py | 2 +- tests/components/nest/test_config_flow.py | 2 +- tests/components/tedee/conftest.py | 2 +- 8 files changed, 11 insertions(+), 8 deletions(-) diff --git a/tests/components/hassio/test_sensor.py b/tests/components/hassio/test_sensor.py index 8780d57da45..71b867d849d 100644 --- a/tests/components/hassio/test_sensor.py +++ b/tests/components/hassio/test_sensor.py @@ -28,7 +28,7 @@ MOCK_ENVIRON = {"SUPERVISOR": "127.0.0.1", "SUPERVISOR_TOKEN": "abcdefgh"} @pytest.fixture(autouse=True) -def mock_all(aioclient_mock: AiohttpClientMocker, request): +def mock_all(aioclient_mock: AiohttpClientMocker) -> None: """Mock all setup requests.""" _install_default_mocks(aioclient_mock) _install_test_addon_stats_mock(aioclient_mock) diff --git a/tests/components/homekit_controller/conftest.py b/tests/components/homekit_controller/conftest.py index ae2ca721cfa..9376a08697d 100644 --- a/tests/components/homekit_controller/conftest.py +++ b/tests/components/homekit_controller/conftest.py @@ -1,10 +1,12 @@ """HomeKit controller session fixtures.""" +from collections.abc import Generator import datetime import unittest.mock from aiohomekit.testing import FakeController from freezegun import freeze_time +from freezegun.api import FrozenDateTimeFactory import pytest import homeassistant.util.dt as dt_util @@ -15,7 +17,7 @@ pytest.register_assert_rewrite("tests.components.homekit_controller.common") @pytest.fixture(autouse=True) -def freeze_time_in_future(request): +def freeze_time_in_future() -> Generator[FrozenDateTimeFactory, None, None]: """Freeze time at a known point.""" now = dt_util.utcnow() start_dt = datetime.datetime(now.year + 1, 1, 1, 0, 0, 0, tzinfo=now.tzinfo) diff --git a/tests/components/ipma/test_config_flow.py b/tests/components/ipma/test_config_flow.py index ef9b667f03d..38c142ace2a 100644 --- a/tests/components/ipma/test_config_flow.py +++ b/tests/components/ipma/test_config_flow.py @@ -1,5 +1,6 @@ """Tests for IPMA config flow.""" +from collections.abc import Generator from unittest.mock import patch from pyipma import IPMAException @@ -15,7 +16,7 @@ from tests.components.ipma import MockLocation @pytest.fixture(name="ipma_setup", autouse=True) -def ipma_setup_fixture(request): +def ipma_setup_fixture() -> Generator[None, None, None]: """Patch ipma setup entry.""" with patch("homeassistant.components.ipma.async_setup_entry", return_value=True): yield diff --git a/tests/components/knx/conftest.py b/tests/components/knx/conftest.py index 864a160ac1a..5cdeb0d8adb 100644 --- a/tests/components/knx/conftest.py +++ b/tests/components/knx/conftest.py @@ -266,7 +266,7 @@ def mock_config_entry() -> MockConfigEntry: @pytest.fixture -async def knx(request, hass, mock_config_entry: MockConfigEntry): +async def knx(hass: HomeAssistant, mock_config_entry: MockConfigEntry): """Create a KNX TestKit instance.""" knx_test_kit = KNXTestKit(hass, mock_config_entry) yield knx_test_kit diff --git a/tests/components/lametric/conftest.py b/tests/components/lametric/conftest.py index bd2ae275970..946efda9210 100644 --- a/tests/components/lametric/conftest.py +++ b/tests/components/lametric/conftest.py @@ -74,7 +74,7 @@ def device_fixture() -> str: @pytest.fixture -def mock_lametric(request, device_fixture: str) -> Generator[MagicMock, None, None]: +def mock_lametric(device_fixture: str) -> Generator[MagicMock, None, None]: """Return a mocked LaMetric TIME client.""" with ( patch( diff --git a/tests/components/nest/conftest.py b/tests/components/nest/conftest.py index b2e8302a7ad..006792bf35e 100644 --- a/tests/components/nest/conftest.py +++ b/tests/components/nest/conftest.py @@ -196,7 +196,7 @@ def subscriber_id() -> str: @pytest.fixture -def nest_test_config(request) -> NestTestConfig: +def nest_test_config() -> NestTestConfig: """Fixture that sets up the configuration used for the test.""" return TEST_CONFIG_APP_CREDS diff --git a/tests/components/nest/test_config_flow.py b/tests/components/nest/test_config_flow.py index abffb33b6b9..5c8f01c8e39 100644 --- a/tests/components/nest/test_config_flow.py +++ b/tests/components/nest/test_config_flow.py @@ -48,7 +48,7 @@ FAKE_DHCP_DATA = dhcp.DhcpServiceInfo( @pytest.fixture -def nest_test_config(request) -> NestTestConfig: +def nest_test_config() -> NestTestConfig: """Fixture with empty configuration and no existing config entry.""" return TEST_CONFIGFLOW_APP_CREDS diff --git a/tests/components/tedee/conftest.py b/tests/components/tedee/conftest.py index 14499935de2..1a8880936b1 100644 --- a/tests/components/tedee/conftest.py +++ b/tests/components/tedee/conftest.py @@ -46,7 +46,7 @@ def mock_setup_entry() -> Generator[AsyncMock, None, None]: @pytest.fixture -def mock_tedee(request) -> Generator[MagicMock, None, None]: +def mock_tedee() -> Generator[MagicMock, None, None]: """Return a mocked Tedee client.""" with ( patch(