diff --git a/tests/components/bmw_connected_drive/test_button.py b/tests/components/bmw_connected_drive/test_button.py index 25d01fa74c9..3c7db219d54 100644 --- a/tests/components/bmw_connected_drive/test_button.py +++ b/tests/components/bmw_connected_drive/test_button.py @@ -14,10 +14,10 @@ from homeassistant.exceptions import HomeAssistantError from . import check_remote_service_call, setup_mocked_integration +@pytest.mark.usefixtures("bmw_fixture") +@pytest.mark.usefixtures("entity_registry_enabled_by_default") async def test_entity_state_attrs( hass: HomeAssistant, - bmw_fixture: respx.Router, - entity_registry_enabled_by_default: None, snapshot: SnapshotAssertion, ) -> None: """Test button options and values.""" @@ -57,9 +57,9 @@ async def test_service_call_success( check_remote_service_call(bmw_fixture, remote_service) +@pytest.mark.usefixtures("bmw_fixture") async def test_service_call_fail( hass: HomeAssistant, - bmw_fixture: respx.Router, monkeypatch: pytest.MonkeyPatch, ) -> None: """Test failed button press.""" diff --git a/tests/components/bmw_connected_drive/test_coordinator.py b/tests/components/bmw_connected_drive/test_coordinator.py index 812d309a257..5b3f99a9414 100644 --- a/tests/components/bmw_connected_drive/test_coordinator.py +++ b/tests/components/bmw_connected_drive/test_coordinator.py @@ -5,7 +5,7 @@ from unittest.mock import patch from bimmer_connected.models import MyBMWAPIError, MyBMWAuthError from freezegun.api import FrozenDateTimeFactory -import respx +import pytest from homeassistant.components.bmw_connected_drive import DOMAIN as BMW_DOMAIN from homeassistant.core import DOMAIN as HA_DOMAIN, HomeAssistant @@ -18,7 +18,8 @@ from . import FIXTURE_CONFIG_ENTRY from tests.common import MockConfigEntry, async_fire_time_changed -async def test_update_success(hass: HomeAssistant, bmw_fixture: respx.Router) -> None: +@pytest.mark.usefixtures("bmw_fixture") +async def test_update_success(hass: HomeAssistant) -> None: """Test the reauth form.""" config_entry = MockConfigEntry(**FIXTURE_CONFIG_ENTRY) config_entry.add_to_hass(hass) @@ -32,8 +33,10 @@ async def test_update_success(hass: HomeAssistant, bmw_fixture: respx.Router) -> ) +@pytest.mark.usefixtures("bmw_fixture") async def test_update_failed( - hass: HomeAssistant, bmw_fixture: respx.Router, freezer: FrozenDateTimeFactory + hass: HomeAssistant, + freezer: FrozenDateTimeFactory, ) -> None: """Test the reauth form.""" config_entry = MockConfigEntry(**FIXTURE_CONFIG_ENTRY) @@ -59,8 +62,10 @@ async def test_update_failed( assert isinstance(coordinator.last_exception, UpdateFailed) is True +@pytest.mark.usefixtures("bmw_fixture") async def test_update_reauth( - hass: HomeAssistant, bmw_fixture: respx.Router, freezer: FrozenDateTimeFactory + hass: HomeAssistant, + freezer: FrozenDateTimeFactory, ) -> None: """Test the reauth form.""" config_entry = MockConfigEntry(**FIXTURE_CONFIG_ENTRY) @@ -96,10 +101,9 @@ async def test_update_reauth( assert isinstance(coordinator.last_exception, ConfigEntryAuthFailed) is True +@pytest.mark.usefixtures("bmw_fixture") async def test_init_reauth( hass: HomeAssistant, - bmw_fixture: respx.Router, - freezer: FrozenDateTimeFactory, issue_registry: ir.IssueRegistry, ) -> None: """Test the reauth form.""" diff --git a/tests/components/bmw_connected_drive/test_diagnostics.py b/tests/components/bmw_connected_drive/test_diagnostics.py index fedfb1c2351..984275eab6a 100644 --- a/tests/components/bmw_connected_drive/test_diagnostics.py +++ b/tests/components/bmw_connected_drive/test_diagnostics.py @@ -19,11 +19,11 @@ from tests.typing import ClientSessionGenerator @pytest.mark.freeze_time(datetime.datetime(2022, 7, 10, 11, tzinfo=datetime.UTC)) +@pytest.mark.usefixtures("bmw_fixture") +@pytest.mark.usefixtures("entity_registry_enabled_by_default") async def test_config_entry_diagnostics( hass: HomeAssistant, hass_client: ClientSessionGenerator, - bmw_fixture, - entity_registry_enabled_by_default: None, snapshot: SnapshotAssertion, ) -> None: """Test config entry diagnostics.""" @@ -38,12 +38,12 @@ async def test_config_entry_diagnostics( @pytest.mark.freeze_time(datetime.datetime(2022, 7, 10, 11, tzinfo=datetime.UTC)) +@pytest.mark.usefixtures("bmw_fixture") +@pytest.mark.usefixtures("entity_registry_enabled_by_default") async def test_device_diagnostics( hass: HomeAssistant, hass_client: ClientSessionGenerator, device_registry: dr.DeviceRegistry, - bmw_fixture, - entity_registry_enabled_by_default: None, snapshot: SnapshotAssertion, ) -> None: """Test device diagnostics.""" @@ -63,12 +63,12 @@ async def test_device_diagnostics( @pytest.mark.freeze_time(datetime.datetime(2022, 7, 10, 11, tzinfo=datetime.UTC)) +@pytest.mark.usefixtures("bmw_fixture") +@pytest.mark.usefixtures("entity_registry_enabled_by_default") async def test_device_diagnostics_vehicle_not_found( hass: HomeAssistant, hass_client: ClientSessionGenerator, device_registry: dr.DeviceRegistry, - bmw_fixture, - entity_registry_enabled_by_default: None, snapshot: SnapshotAssertion, ) -> None: """Test device diagnostics when the vehicle cannot be found.""" diff --git a/tests/components/bmw_connected_drive/test_init.py b/tests/components/bmw_connected_drive/test_init.py index b8081d8d119..d648ad65f5d 100644 --- a/tests/components/bmw_connected_drive/test_init.py +++ b/tests/components/bmw_connected_drive/test_init.py @@ -3,7 +3,6 @@ from unittest.mock import patch import pytest -import respx from homeassistant.components.bmw_connected_drive.const import DOMAIN as BMW_DOMAIN from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN @@ -137,10 +136,10 @@ async def test_dont_migrate_unique_ids( assert entity_migrated != entity_not_changed +@pytest.mark.usefixtures("bmw_fixture") async def test_remove_stale_devices( hass: HomeAssistant, device_registry: dr.DeviceRegistry, - bmw_fixture: respx.Router, ) -> None: """Test remove stale device registry entries.""" mock_config_entry = MockConfigEntry(**FIXTURE_CONFIG_ENTRY) diff --git a/tests/components/bmw_connected_drive/test_number.py b/tests/components/bmw_connected_drive/test_number.py index 1047e595c95..53e61439003 100644 --- a/tests/components/bmw_connected_drive/test_number.py +++ b/tests/components/bmw_connected_drive/test_number.py @@ -14,10 +14,10 @@ from homeassistant.exceptions import HomeAssistantError from . import check_remote_service_call, setup_mocked_integration +@pytest.mark.usefixtures("bmw_fixture") +@pytest.mark.usefixtures("entity_registry_enabled_by_default") async def test_entity_state_attrs( hass: HomeAssistant, - bmw_fixture: respx.Router, - entity_registry_enabled_by_default: None, snapshot: SnapshotAssertion, ) -> None: """Test number options and values..""" @@ -62,6 +62,7 @@ async def test_service_call_success( assert hass.states.get(entity_id).state == new_value +@pytest.mark.usefixtures("bmw_fixture") @pytest.mark.parametrize( ("entity_id", "value"), [ @@ -72,7 +73,6 @@ async def test_service_call_invalid_input( hass: HomeAssistant, entity_id: str, value: str, - bmw_fixture: respx.Router, ) -> None: """Test not allowed values for number inputs.""" @@ -92,6 +92,7 @@ async def test_service_call_invalid_input( assert hass.states.get(entity_id).state == old_value +@pytest.mark.usefixtures("bmw_fixture") @pytest.mark.parametrize( ("raised", "expected"), [ @@ -104,7 +105,6 @@ async def test_service_call_fail( hass: HomeAssistant, raised: Exception, expected: Exception, - bmw_fixture: respx.Router, monkeypatch: pytest.MonkeyPatch, ) -> None: """Test exception handling.""" diff --git a/tests/components/bmw_connected_drive/test_select.py b/tests/components/bmw_connected_drive/test_select.py index 0c78d89cd8a..f3877119e3e 100644 --- a/tests/components/bmw_connected_drive/test_select.py +++ b/tests/components/bmw_connected_drive/test_select.py @@ -14,10 +14,10 @@ from homeassistant.exceptions import HomeAssistantError, ServiceValidationError from . import check_remote_service_call, setup_mocked_integration +@pytest.mark.usefixtures("bmw_fixture") +@pytest.mark.usefixtures("entity_registry_enabled_by_default") async def test_entity_state_attrs( hass: HomeAssistant, - bmw_fixture: respx.Router, - entity_registry_enabled_by_default: None, snapshot: SnapshotAssertion, ) -> None: """Test select options and values..""" @@ -74,6 +74,7 @@ async def test_service_call_success( assert hass.states.get(entity_id).state == new_value +@pytest.mark.usefixtures("bmw_fixture") @pytest.mark.parametrize( ("entity_id", "value"), [ @@ -85,7 +86,6 @@ async def test_service_call_invalid_input( hass: HomeAssistant, entity_id: str, value: str, - bmw_fixture: respx.Router, ) -> None: """Test not allowed values for select inputs.""" @@ -105,6 +105,7 @@ async def test_service_call_invalid_input( assert hass.states.get(entity_id).state == old_value +@pytest.mark.usefixtures("bmw_fixture") @pytest.mark.parametrize( ("raised", "expected"), [ @@ -117,7 +118,6 @@ async def test_service_call_fail( hass: HomeAssistant, raised: Exception, expected: Exception, - bmw_fixture: respx.Router, monkeypatch: pytest.MonkeyPatch, ) -> None: """Test exception handling.""" diff --git a/tests/components/bmw_connected_drive/test_sensor.py b/tests/components/bmw_connected_drive/test_sensor.py index 18c589bb72a..2e48189e4a1 100644 --- a/tests/components/bmw_connected_drive/test_sensor.py +++ b/tests/components/bmw_connected_drive/test_sensor.py @@ -1,8 +1,6 @@ """Test BMW sensors.""" -from freezegun import freeze_time import pytest -import respx from syrupy.assertion import SnapshotAssertion from homeassistant.core import HomeAssistant @@ -15,11 +13,11 @@ from homeassistant.util.unit_system import ( from . import setup_mocked_integration -@freeze_time("2023-06-22 10:30:00+00:00") +@pytest.mark.freeze_time("2023-06-22 10:30:00+00:00") +@pytest.mark.usefixtures("bmw_fixture") +@pytest.mark.usefixtures("entity_registry_enabled_by_default") async def test_entity_state_attrs( hass: HomeAssistant, - bmw_fixture: respx.Router, - entity_registry_enabled_by_default: None, snapshot: SnapshotAssertion, ) -> None: """Test sensor options and values..""" @@ -31,6 +29,7 @@ async def test_entity_state_attrs( assert hass.states.async_all("sensor") == snapshot +@pytest.mark.usefixtures("bmw_fixture") @pytest.mark.parametrize( ("entity_id", "unit_system", "value", "unit_of_measurement"), [ @@ -56,7 +55,6 @@ async def test_unit_conversion( unit_system: UnitSystem, value: str, unit_of_measurement: str, - bmw_fixture, ) -> None: """Test conversion between metric and imperial units for sensors.""" diff --git a/tests/components/bmw_connected_drive/test_switch.py b/tests/components/bmw_connected_drive/test_switch.py index a667966d099..6cf20d8077e 100644 --- a/tests/components/bmw_connected_drive/test_switch.py +++ b/tests/components/bmw_connected_drive/test_switch.py @@ -14,10 +14,9 @@ from homeassistant.exceptions import HomeAssistantError from . import check_remote_service_call, setup_mocked_integration +@pytest.mark.usefixtures("bmw_fixture") async def test_entity_state_attrs( hass: HomeAssistant, - bmw_fixture: respx.Router, - entity_registry_enabled_by_default: None, snapshot: SnapshotAssertion, ) -> None: """Test switch options and values..""" @@ -65,6 +64,7 @@ async def test_service_call_success( assert hass.states.get(entity_id).state == new_value +@pytest.mark.usefixtures("bmw_fixture") @pytest.mark.parametrize( ("raised", "expected"), [ @@ -77,7 +77,6 @@ async def test_service_call_fail( hass: HomeAssistant, raised: Exception, expected: Exception, - bmw_fixture: respx.Router, monkeypatch: pytest.MonkeyPatch, ) -> None: """Test exception handling."""