Cleanup unused FixtureRequest in tests (#118780)

This commit is contained in:
epenet 2024-06-04 11:49:21 +02:00 committed by GitHub
parent fce5f2a93f
commit 3ac0fa53c8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 11 additions and 8 deletions

View file

@ -28,7 +28,7 @@ MOCK_ENVIRON = {"SUPERVISOR": "127.0.0.1", "SUPERVISOR_TOKEN": "abcdefgh"}
@pytest.fixture(autouse=True) @pytest.fixture(autouse=True)
def mock_all(aioclient_mock: AiohttpClientMocker, request): def mock_all(aioclient_mock: AiohttpClientMocker) -> None:
"""Mock all setup requests.""" """Mock all setup requests."""
_install_default_mocks(aioclient_mock) _install_default_mocks(aioclient_mock)
_install_test_addon_stats_mock(aioclient_mock) _install_test_addon_stats_mock(aioclient_mock)

View file

@ -1,10 +1,12 @@
"""HomeKit controller session fixtures.""" """HomeKit controller session fixtures."""
from collections.abc import Generator
import datetime import datetime
import unittest.mock import unittest.mock
from aiohomekit.testing import FakeController from aiohomekit.testing import FakeController
from freezegun import freeze_time from freezegun import freeze_time
from freezegun.api import FrozenDateTimeFactory
import pytest import pytest
import homeassistant.util.dt as dt_util import homeassistant.util.dt as dt_util
@ -15,7 +17,7 @@ pytest.register_assert_rewrite("tests.components.homekit_controller.common")
@pytest.fixture(autouse=True) @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.""" """Freeze time at a known point."""
now = dt_util.utcnow() now = dt_util.utcnow()
start_dt = datetime.datetime(now.year + 1, 1, 1, 0, 0, 0, tzinfo=now.tzinfo) start_dt = datetime.datetime(now.year + 1, 1, 1, 0, 0, 0, tzinfo=now.tzinfo)

View file

@ -1,5 +1,6 @@
"""Tests for IPMA config flow.""" """Tests for IPMA config flow."""
from collections.abc import Generator
from unittest.mock import patch from unittest.mock import patch
from pyipma import IPMAException from pyipma import IPMAException
@ -15,7 +16,7 @@ from tests.components.ipma import MockLocation
@pytest.fixture(name="ipma_setup", autouse=True) @pytest.fixture(name="ipma_setup", autouse=True)
def ipma_setup_fixture(request): def ipma_setup_fixture() -> Generator[None, None, None]:
"""Patch ipma setup entry.""" """Patch ipma setup entry."""
with patch("homeassistant.components.ipma.async_setup_entry", return_value=True): with patch("homeassistant.components.ipma.async_setup_entry", return_value=True):
yield yield

View file

@ -266,7 +266,7 @@ def mock_config_entry() -> MockConfigEntry:
@pytest.fixture @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.""" """Create a KNX TestKit instance."""
knx_test_kit = KNXTestKit(hass, mock_config_entry) knx_test_kit = KNXTestKit(hass, mock_config_entry)
yield knx_test_kit yield knx_test_kit

View file

@ -74,7 +74,7 @@ def device_fixture() -> str:
@pytest.fixture @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.""" """Return a mocked LaMetric TIME client."""
with ( with (
patch( patch(

View file

@ -196,7 +196,7 @@ def subscriber_id() -> str:
@pytest.fixture @pytest.fixture
def nest_test_config(request) -> NestTestConfig: def nest_test_config() -> NestTestConfig:
"""Fixture that sets up the configuration used for the test.""" """Fixture that sets up the configuration used for the test."""
return TEST_CONFIG_APP_CREDS return TEST_CONFIG_APP_CREDS

View file

@ -48,7 +48,7 @@ FAKE_DHCP_DATA = dhcp.DhcpServiceInfo(
@pytest.fixture @pytest.fixture
def nest_test_config(request) -> NestTestConfig: def nest_test_config() -> NestTestConfig:
"""Fixture with empty configuration and no existing config entry.""" """Fixture with empty configuration and no existing config entry."""
return TEST_CONFIGFLOW_APP_CREDS return TEST_CONFIGFLOW_APP_CREDS

View file

@ -46,7 +46,7 @@ def mock_setup_entry() -> Generator[AsyncMock, None, None]:
@pytest.fixture @pytest.fixture
def mock_tedee(request) -> Generator[MagicMock, None, None]: def mock_tedee() -> Generator[MagicMock, None, None]:
"""Return a mocked Tedee client.""" """Return a mocked Tedee client."""
with ( with (
patch( patch(