From 2c7022950c84d7c5a4571c70b8bf133e1e180d98 Mon Sep 17 00:00:00 2001
From: epenet <6771947+epenet@users.noreply.github.com>
Date: Tue, 11 Jun 2024 14:57:50 +0200
Subject: [PATCH] Fix import-outside-toplevel pylint warnings in tests
 (#119389)

---
 .../components/arcam_fmj/test_media_player.py |  12 +-
 tests/components/dsmr/test_mbus_migration.py  |  21 +--
 tests/components/dsmr/test_sensor.py          | 131 ++++--------------
 tests/components/izone/test_config_flow.py    |   3 +-
 tests/components/litterrobot/test_sensor.py   |   2 +-
 tests/components/mqtt/test_init.py            |   3 +-
 tests/components/recorder/db_schema_0.py      |   3 +-
 tests/components/recorder/test_util.py        |   4 +-
 tests/components/spc/test_init.py             |   5 +-
 tests/components/sun/test_init.py             |   5 +-
 tests/components/upb/test_config_flow.py      |   2 +-
 tests/components/v2c/test_sensor.py           |   3 +-
 12 files changed, 52 insertions(+), 142 deletions(-)

diff --git a/tests/components/arcam_fmj/test_media_player.py b/tests/components/arcam_fmj/test_media_player.py
index 0baa8ba6870..1fa67691895 100644
--- a/tests/components/arcam_fmj/test_media_player.py
+++ b/tests/components/arcam_fmj/test_media_player.py
@@ -6,6 +6,12 @@ from unittest.mock import ANY, PropertyMock, patch
 from arcam.fmj import ConnectionFailed, DecodeMode2CH, DecodeModeMCH, SourceCodes
 import pytest
 
+from homeassistant.components.arcam_fmj.const import (
+    SIGNAL_CLIENT_DATA,
+    SIGNAL_CLIENT_STARTED,
+    SIGNAL_CLIENT_STOPPED,
+)
+from homeassistant.components.arcam_fmj.media_player import ArcamFmj
 from homeassistant.components.homeassistant import (
     DOMAIN as HA_DOMAIN,
     SERVICE_UPDATE_ENTITY,
@@ -338,7 +344,6 @@ async def test_media_artist(player, state, source, dls, artist) -> None:
 )
 async def test_media_title(player, state, source, channel, title) -> None:
     """Test media title."""
-    from homeassistant.components.arcam_fmj.media_player import ArcamFmj
 
     state.get_source.return_value = source
     with patch.object(
@@ -354,11 +359,6 @@ async def test_media_title(player, state, source, channel, title) -> None:
 
 async def test_added_to_hass(player, state) -> None:
     """Test addition to hass."""
-    from homeassistant.components.arcam_fmj.const import (
-        SIGNAL_CLIENT_DATA,
-        SIGNAL_CLIENT_STARTED,
-        SIGNAL_CLIENT_STOPPED,
-    )
 
     with patch(
         "homeassistant.components.arcam_fmj.media_player.async_dispatcher_connect"
diff --git a/tests/components/dsmr/test_mbus_migration.py b/tests/components/dsmr/test_mbus_migration.py
index 429128c48bb..284a0001b89 100644
--- a/tests/components/dsmr/test_mbus_migration.py
+++ b/tests/components/dsmr/test_mbus_migration.py
@@ -3,6 +3,13 @@
 import datetime
 from decimal import Decimal
 
+from dsmr_parser.obis_references import (
+    BELGIUM_MBUS1_DEVICE_TYPE,
+    BELGIUM_MBUS1_EQUIPMENT_IDENTIFIER,
+    BELGIUM_MBUS1_METER_READING2,
+)
+from dsmr_parser.objects import CosemObject, MBusObject
+
 from homeassistant.components.dsmr.const import DOMAIN
 from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN
 from homeassistant.core import HomeAssistant
@@ -20,13 +27,6 @@ async def test_migrate_gas_to_mbus(
     """Test migration of unique_id."""
     (connection_factory, transport, protocol) = dsmr_connection_fixture
 
-    from dsmr_parser.obis_references import (
-        BELGIUM_MBUS1_DEVICE_TYPE,
-        BELGIUM_MBUS1_EQUIPMENT_IDENTIFIER,
-        BELGIUM_MBUS1_METER_READING2,
-    )
-    from dsmr_parser.objects import CosemObject, MBusObject
-
     mock_entry = MockConfigEntry(
         domain=DOMAIN,
         unique_id="/dev/ttyUSB0",
@@ -118,13 +118,6 @@ async def test_migrate_gas_to_mbus_exists(
     """Test migration of unique_id."""
     (connection_factory, transport, protocol) = dsmr_connection_fixture
 
-    from dsmr_parser.obis_references import (
-        BELGIUM_MBUS1_DEVICE_TYPE,
-        BELGIUM_MBUS1_EQUIPMENT_IDENTIFIER,
-        BELGIUM_MBUS1_METER_READING2,
-    )
-    from dsmr_parser.objects import CosemObject, MBusObject
-
     mock_entry = MockConfigEntry(
         domain=DOMAIN,
         unique_id="/dev/ttyUSB0",
diff --git a/tests/components/dsmr/test_sensor.py b/tests/components/dsmr/test_sensor.py
index 7a38e3010d8..e014fdb68f2 100644
--- a/tests/components/dsmr/test_sensor.py
+++ b/tests/components/dsmr/test_sensor.py
@@ -11,6 +11,33 @@ from decimal import Decimal
 from itertools import chain, repeat
 from unittest.mock import DEFAULT, MagicMock
 
+from dsmr_parser.obis_references import (
+    BELGIUM_CURRENT_AVERAGE_DEMAND,
+    BELGIUM_MAXIMUM_DEMAND_MONTH,
+    BELGIUM_MBUS1_DEVICE_TYPE,
+    BELGIUM_MBUS1_EQUIPMENT_IDENTIFIER,
+    BELGIUM_MBUS1_METER_READING1,
+    BELGIUM_MBUS1_METER_READING2,
+    BELGIUM_MBUS2_DEVICE_TYPE,
+    BELGIUM_MBUS2_EQUIPMENT_IDENTIFIER,
+    BELGIUM_MBUS2_METER_READING1,
+    BELGIUM_MBUS2_METER_READING2,
+    BELGIUM_MBUS3_DEVICE_TYPE,
+    BELGIUM_MBUS3_EQUIPMENT_IDENTIFIER,
+    BELGIUM_MBUS3_METER_READING1,
+    BELGIUM_MBUS3_METER_READING2,
+    BELGIUM_MBUS4_DEVICE_TYPE,
+    BELGIUM_MBUS4_EQUIPMENT_IDENTIFIER,
+    BELGIUM_MBUS4_METER_READING1,
+    BELGIUM_MBUS4_METER_READING2,
+    CURRENT_ELECTRICITY_USAGE,
+    ELECTRICITY_ACTIVE_TARIFF,
+    ELECTRICITY_EXPORTED_TOTAL,
+    ELECTRICITY_IMPORTED_TOTAL,
+    GAS_METER_READING,
+    HOURLY_GAS_METER_READING,
+)
+from dsmr_parser.objects import CosemObject, MBusObject
 import pytest
 
 from homeassistant.components.sensor import (
@@ -41,13 +68,6 @@ async def test_default_setup(
     """Test the default setup."""
     (connection_factory, transport, protocol) = dsmr_connection_fixture
 
-    from dsmr_parser.obis_references import (
-        CURRENT_ELECTRICITY_USAGE,
-        ELECTRICITY_ACTIVE_TARIFF,
-        GAS_METER_READING,
-    )
-    from dsmr_parser.objects import CosemObject, MBusObject
-
     entry_data = {
         "port": "/dev/ttyUSB0",
         "dsmr_version": "2.2",
@@ -176,12 +196,6 @@ async def test_setup_only_energy(
     """Test the default setup."""
     (connection_factory, transport, protocol) = dsmr_connection_fixture
 
-    from dsmr_parser.obis_references import (
-        CURRENT_ELECTRICITY_USAGE,
-        ELECTRICITY_ACTIVE_TARIFF,
-    )
-    from dsmr_parser.objects import CosemObject
-
     entry_data = {
         "port": "/dev/ttyUSB0",
         "dsmr_version": "2.2",
@@ -230,12 +244,6 @@ async def test_v4_meter(hass: HomeAssistant, dsmr_connection_fixture) -> None:
     """Test if v4 meter is correctly parsed."""
     (connection_factory, transport, protocol) = dsmr_connection_fixture
 
-    from dsmr_parser.obis_references import (
-        ELECTRICITY_ACTIVE_TARIFF,
-        HOURLY_GAS_METER_READING,
-    )
-    from dsmr_parser.objects import CosemObject, MBusObject
-
     entry_data = {
         "port": "/dev/ttyUSB0",
         "dsmr_version": "4",
@@ -316,12 +324,6 @@ async def test_v5_meter(
     """Test if v5 meter is correctly parsed."""
     (connection_factory, transport, protocol) = dsmr_connection_fixture
 
-    from dsmr_parser.obis_references import (
-        ELECTRICITY_ACTIVE_TARIFF,
-        HOURLY_GAS_METER_READING,
-    )
-    from dsmr_parser.objects import CosemObject, MBusObject
-
     entry_data = {
         "port": "/dev/ttyUSB0",
         "dsmr_version": "5",
@@ -388,13 +390,6 @@ async def test_luxembourg_meter(hass: HomeAssistant, dsmr_connection_fixture) ->
     """Test if v5 meter is correctly parsed."""
     (connection_factory, transport, protocol) = dsmr_connection_fixture
 
-    from dsmr_parser.obis_references import (
-        ELECTRICITY_EXPORTED_TOTAL,
-        ELECTRICITY_IMPORTED_TOTAL,
-        HOURLY_GAS_METER_READING,
-    )
-    from dsmr_parser.objects import CosemObject, MBusObject
-
     entry_data = {
         "port": "/dev/ttyUSB0",
         "dsmr_version": "5L",
@@ -477,25 +472,6 @@ async def test_belgian_meter(hass: HomeAssistant, dsmr_connection_fixture) -> No
     """Test if Belgian meter is correctly parsed."""
     (connection_factory, transport, protocol) = dsmr_connection_fixture
 
-    from dsmr_parser.obis_references import (
-        BELGIUM_CURRENT_AVERAGE_DEMAND,
-        BELGIUM_MAXIMUM_DEMAND_MONTH,
-        BELGIUM_MBUS1_DEVICE_TYPE,
-        BELGIUM_MBUS1_EQUIPMENT_IDENTIFIER,
-        BELGIUM_MBUS1_METER_READING2,
-        BELGIUM_MBUS2_DEVICE_TYPE,
-        BELGIUM_MBUS2_EQUIPMENT_IDENTIFIER,
-        BELGIUM_MBUS2_METER_READING1,
-        BELGIUM_MBUS3_DEVICE_TYPE,
-        BELGIUM_MBUS3_EQUIPMENT_IDENTIFIER,
-        BELGIUM_MBUS3_METER_READING2,
-        BELGIUM_MBUS4_DEVICE_TYPE,
-        BELGIUM_MBUS4_EQUIPMENT_IDENTIFIER,
-        BELGIUM_MBUS4_METER_READING1,
-        ELECTRICITY_ACTIVE_TARIFF,
-    )
-    from dsmr_parser.objects import CosemObject, MBusObject
-
     entry_data = {
         "port": "/dev/ttyUSB0",
         "dsmr_version": "5B",
@@ -679,22 +655,6 @@ async def test_belgian_meter_alt(hass: HomeAssistant, dsmr_connection_fixture) -
     """Test if Belgian meter is correctly parsed."""
     (connection_factory, transport, protocol) = dsmr_connection_fixture
 
-    from dsmr_parser.obis_references import (
-        BELGIUM_MBUS1_DEVICE_TYPE,
-        BELGIUM_MBUS1_EQUIPMENT_IDENTIFIER,
-        BELGIUM_MBUS1_METER_READING1,
-        BELGIUM_MBUS2_DEVICE_TYPE,
-        BELGIUM_MBUS2_EQUIPMENT_IDENTIFIER,
-        BELGIUM_MBUS2_METER_READING2,
-        BELGIUM_MBUS3_DEVICE_TYPE,
-        BELGIUM_MBUS3_EQUIPMENT_IDENTIFIER,
-        BELGIUM_MBUS3_METER_READING1,
-        BELGIUM_MBUS4_DEVICE_TYPE,
-        BELGIUM_MBUS4_EQUIPMENT_IDENTIFIER,
-        BELGIUM_MBUS4_METER_READING2,
-    )
-    from dsmr_parser.objects import CosemObject, MBusObject
-
     entry_data = {
         "port": "/dev/ttyUSB0",
         "dsmr_version": "5B",
@@ -842,20 +802,6 @@ async def test_belgian_meter_mbus(hass: HomeAssistant, dsmr_connection_fixture)
     """Test if Belgian meter is correctly parsed."""
     (connection_factory, transport, protocol) = dsmr_connection_fixture
 
-    from dsmr_parser.obis_references import (
-        BELGIUM_MBUS1_DEVICE_TYPE,
-        BELGIUM_MBUS1_EQUIPMENT_IDENTIFIER,
-        BELGIUM_MBUS2_DEVICE_TYPE,
-        BELGIUM_MBUS2_EQUIPMENT_IDENTIFIER,
-        BELGIUM_MBUS3_DEVICE_TYPE,
-        BELGIUM_MBUS3_EQUIPMENT_IDENTIFIER,
-        BELGIUM_MBUS3_METER_READING2,
-        BELGIUM_MBUS4_DEVICE_TYPE,
-        BELGIUM_MBUS4_METER_READING1,
-        ELECTRICITY_ACTIVE_TARIFF,
-    )
-    from dsmr_parser.objects import CosemObject, MBusObject
-
     entry_data = {
         "port": "/dev/ttyUSB0",
         "dsmr_version": "5B",
@@ -963,9 +909,6 @@ async def test_belgian_meter_low(hass: HomeAssistant, dsmr_connection_fixture) -
     """Test if Belgian meter is correctly parsed."""
     (connection_factory, transport, protocol) = dsmr_connection_fixture
 
-    from dsmr_parser.obis_references import ELECTRICITY_ACTIVE_TARIFF
-    from dsmr_parser.objects import CosemObject
-
     entry_data = {
         "port": "/dev/ttyUSB0",
         "dsmr_version": "5B",
@@ -1012,12 +955,6 @@ async def test_swedish_meter(hass: HomeAssistant, dsmr_connection_fixture) -> No
     """Test if v5 meter is correctly parsed."""
     (connection_factory, transport, protocol) = dsmr_connection_fixture
 
-    from dsmr_parser.obis_references import (
-        ELECTRICITY_EXPORTED_TOTAL,
-        ELECTRICITY_IMPORTED_TOTAL,
-    )
-    from dsmr_parser.objects import CosemObject
-
     entry_data = {
         "port": "/dev/ttyUSB0",
         "dsmr_version": "5S",
@@ -1084,12 +1021,6 @@ async def test_easymeter(hass: HomeAssistant, dsmr_connection_fixture) -> None:
     """Test if Q3D meter is correctly parsed."""
     (connection_factory, transport, protocol) = dsmr_connection_fixture
 
-    from dsmr_parser.obis_references import (
-        ELECTRICITY_EXPORTED_TOTAL,
-        ELECTRICITY_IMPORTED_TOTAL,
-    )
-    from dsmr_parser.objects import CosemObject
-
     entry_data = {
         "port": "/dev/ttyUSB0",
         "dsmr_version": "Q3D",
@@ -1248,11 +1179,6 @@ async def test_connection_errors_retry(
 @patch("homeassistant.components.dsmr.sensor.DEFAULT_RECONNECT_INTERVAL", 0)
 async def test_reconnect(hass: HomeAssistant, dsmr_connection_fixture) -> None:
     """If transport disconnects, the connection should be retried."""
-    from dsmr_parser.obis_references import (
-        CURRENT_ELECTRICITY_USAGE,
-        ELECTRICITY_ACTIVE_TARIFF,
-    )
-    from dsmr_parser.objects import CosemObject
 
     (connection_factory, transport, protocol) = dsmr_connection_fixture
 
@@ -1334,9 +1260,6 @@ async def test_gas_meter_providing_energy_reading(
     """Test that gas providing energy readings use the correct device class."""
     (connection_factory, transport, protocol) = dsmr_connection_fixture
 
-    from dsmr_parser.obis_references import GAS_METER_READING
-    from dsmr_parser.objects import MBusObject
-
     entry_data = {
         "port": "/dev/ttyUSB0",
         "dsmr_version": "2.2",
diff --git a/tests/components/izone/test_config_flow.py b/tests/components/izone/test_config_flow.py
index 9f668e1ec62..6591e402ec2 100644
--- a/tests/components/izone/test_config_flow.py
+++ b/tests/components/izone/test_config_flow.py
@@ -8,6 +8,7 @@ from homeassistant import config_entries
 from homeassistant.components.izone.const import DISPATCH_CONTROLLER_DISCOVERED, IZONE
 from homeassistant.core import HomeAssistant
 from homeassistant.data_entry_flow import FlowResultType
+from homeassistant.helpers.dispatcher import async_dispatcher_send
 
 
 @pytest.fixture
@@ -20,8 +21,6 @@ def mock_disco():
 
 
 def _mock_start_discovery(hass, mock_disco):
-    from homeassistant.helpers.dispatcher import async_dispatcher_send
-
     def do_disovered(*args):
         async_dispatcher_send(hass, DISPATCH_CONTROLLER_DISCOVERED, True)
         return mock_disco
diff --git a/tests/components/litterrobot/test_sensor.py b/tests/components/litterrobot/test_sensor.py
index 8d1f2b68e05..360d13096a7 100644
--- a/tests/components/litterrobot/test_sensor.py
+++ b/tests/components/litterrobot/test_sensor.py
@@ -4,6 +4,7 @@ from unittest.mock import MagicMock
 
 import pytest
 
+from homeassistant.components.litterrobot.sensor import icon_for_gauge_level
 from homeassistant.components.sensor import DOMAIN as PLATFORM_DOMAIN, SensorDeviceClass
 from homeassistant.const import PERCENTAGE, STATE_UNKNOWN, UnitOfMass
 from homeassistant.core import HomeAssistant
@@ -47,7 +48,6 @@ async def test_sleep_time_sensor_with_sleep_disabled(
 
 async def test_gauge_icon() -> None:
     """Test icon generator for gauge sensor."""
-    from homeassistant.components.litterrobot.sensor import icon_for_gauge_level
 
     GAUGE_EMPTY = "mdi:gauge-empty"
     GAUGE_LOW = "mdi:gauge-low"
diff --git a/tests/components/mqtt/test_init.py b/tests/components/mqtt/test_init.py
index a780fce83c0..144b2f9cf45 100644
--- a/tests/components/mqtt/test_init.py
+++ b/tests/components/mqtt/test_init.py
@@ -12,6 +12,7 @@ import time
 from typing import Any, TypedDict
 from unittest.mock import ANY, MagicMock, Mock, call, mock_open, patch
 
+import certifi
 from freezegun.api import FrozenDateTimeFactory
 import paho.mqtt.client as paho_mqtt
 import pytest
@@ -2479,8 +2480,6 @@ async def test_setup_uses_certificate_on_certificate_set_to_auto_and_insecure(
 
     assert calls
 
-    import certifi
-
     expected_certificate = certifi.where()
     assert calls[0][0] == expected_certificate
 
diff --git a/tests/components/recorder/db_schema_0.py b/tests/components/recorder/db_schema_0.py
index 9062de01b59..12336dcc96a 100644
--- a/tests/components/recorder/db_schema_0.py
+++ b/tests/components/recorder/db_schema_0.py
@@ -19,6 +19,7 @@ from sqlalchemy import (
     distinct,
 )
 from sqlalchemy.orm import declarative_base
+from sqlalchemy.orm.session import Session
 
 from homeassistant.core import Event, EventOrigin, State, split_entity_id
 from homeassistant.helpers.json import JSONEncoder
@@ -141,8 +142,6 @@ class RecorderRuns(Base):  # type: ignore[valid-type,misc]
         Specify point_in_time if you want to know which existed at that point
         in time inside the run.
         """
-        from sqlalchemy.orm.session import Session
-
         session = Session.object_session(self)
 
         assert session is not None, "RecorderRuns need to be persisted"
diff --git a/tests/components/recorder/test_util.py b/tests/components/recorder/test_util.py
index 974e401264e..d72978c57bb 100644
--- a/tests/components/recorder/test_util.py
+++ b/tests/components/recorder/test_util.py
@@ -10,7 +10,7 @@ from unittest.mock import MagicMock, Mock, patch
 import pytest
 from sqlalchemy import lambda_stmt, text
 from sqlalchemy.engine.result import ChunkedIteratorResult
-from sqlalchemy.exc import SQLAlchemyError
+from sqlalchemy.exc import OperationalError, SQLAlchemyError
 from sqlalchemy.sql.elements import TextClause
 from sqlalchemy.sql.lambdas import StatementLambdaElement
 
@@ -73,7 +73,6 @@ async def test_session_scope_not_setup(
 
 async def test_recorder_bad_execute(hass: HomeAssistant, setup_recorder: None) -> None:
     """Bad execute, retry 3 times."""
-    from sqlalchemy.exc import SQLAlchemyError
 
     def to_native(validate_entity_id=True):
         """Raise exception."""
@@ -854,7 +853,6 @@ async def test_write_lock_db(
     tmp_path: Path,
 ) -> None:
     """Test database write lock."""
-    from sqlalchemy.exc import OperationalError
 
     # Use file DB, in memory DB cannot do write locks.
     config = {
diff --git a/tests/components/spc/test_init.py b/tests/components/spc/test_init.py
index 92c3282dd23..3dfea94a4bd 100644
--- a/tests/components/spc/test_init.py
+++ b/tests/components/spc/test_init.py
@@ -2,6 +2,9 @@
 
 from unittest.mock import Mock, PropertyMock, patch
 
+import pyspcwebgw
+from pyspcwebgw.const import AreaMode
+
 from homeassistant.bootstrap import async_setup_component
 from homeassistant.components.spc import DATA_API
 from homeassistant.const import STATE_ALARM_ARMED_AWAY, STATE_ALARM_DISARMED
@@ -32,8 +35,6 @@ async def test_invalid_device_config(hass: HomeAssistant, monkeypatch) -> None:
 
 async def test_update_alarm_device(hass: HomeAssistant) -> None:
     """Test that alarm panel state changes on incoming websocket data."""
-    import pyspcwebgw
-    from pyspcwebgw.const import AreaMode
 
     config = {"spc": {"api_url": "http://localhost/", "ws_url": "ws://localhost/"}}
 
diff --git a/tests/components/sun/test_init.py b/tests/components/sun/test_init.py
index 48a214274c9..a30076d6d3c 100644
--- a/tests/components/sun/test_init.py
+++ b/tests/components/sun/test_init.py
@@ -3,6 +3,8 @@
 from datetime import datetime, timedelta
 from unittest.mock import patch
 
+from astral import LocationInfo
+import astral.sun
 from freezegun import freeze_time
 import pytest
 
@@ -25,9 +27,6 @@ async def test_setting_rising(hass: HomeAssistant) -> None:
     await hass.async_block_till_done()
     state = hass.states.get(entity.ENTITY_ID)
 
-    from astral import LocationInfo
-    import astral.sun
-
     utc_today = utc_now.date()
 
     location = LocationInfo(
diff --git a/tests/components/upb/test_config_flow.py b/tests/components/upb/test_config_flow.py
index 5eaed2e3a24..d5d6d70bb68 100644
--- a/tests/components/upb/test_config_flow.py
+++ b/tests/components/upb/test_config_flow.py
@@ -1,5 +1,6 @@
 """Test the UPB Control config flow."""
 
+from asyncio import TimeoutError
 from unittest.mock import MagicMock, PropertyMock, patch
 
 from homeassistant import config_entries
@@ -84,7 +85,6 @@ async def test_form_user_with_tcp_upb(hass: HomeAssistant) -> None:
 
 async def test_form_cannot_connect(hass: HomeAssistant) -> None:
     """Test we handle cannot connect error."""
-    from asyncio import TimeoutError
 
     with patch(
         "homeassistant.components.upb.config_flow.asyncio.timeout",
diff --git a/tests/components/v2c/test_sensor.py b/tests/components/v2c/test_sensor.py
index b48a173821c..9e7e3800767 100644
--- a/tests/components/v2c/test_sensor.py
+++ b/tests/components/v2c/test_sensor.py
@@ -5,6 +5,7 @@ from unittest.mock import AsyncMock, patch
 import pytest
 from syrupy import SnapshotAssertion
 
+from homeassistant.components.v2c.sensor import _METER_ERROR_OPTIONS
 from homeassistant.const import Platform
 from homeassistant.core import HomeAssistant
 from homeassistant.helpers import entity_registry as er
@@ -27,8 +28,6 @@ async def test_sensor(
         await init_integration(hass, mock_config_entry)
     await snapshot_platform(hass, entity_registry, snapshot, mock_config_entry.entry_id)
 
-    from homeassistant.components.v2c.sensor import _METER_ERROR_OPTIONS
-
     assert [
         "no_error",
         "communication",
-- 
GitLab