Use relative imports in tests [a-i] (#119280)
parent
e818de1da8
commit
b8e57f6174
|
@ -8,8 +8,9 @@ from homeassistant.components.airgradient import DOMAIN
|
|||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import device_registry as dr
|
||||
|
||||
from . import setup_integration
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
from tests.components.airgradient import setup_integration
|
||||
|
||||
|
||||
async def test_device_info(
|
||||
|
|
|
@ -7,7 +7,7 @@ from homeassistant.const import Platform
|
|||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import device_registry as dr, entity_registry as er
|
||||
|
||||
from tests.components.airthings_ble import (
|
||||
from . import (
|
||||
CO2_V1,
|
||||
CO2_V2,
|
||||
HUMIDITY_V2,
|
||||
|
@ -21,6 +21,7 @@ from tests.components.airthings_ble import (
|
|||
create_entry,
|
||||
patch_airthings_device_update,
|
||||
)
|
||||
|
||||
from tests.components.bluetooth import inject_bluetooth_service_info
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
|
|
@ -24,13 +24,14 @@ from homeassistant.core import HomeAssistant
|
|||
from homeassistant.helpers import device_registry as dr, entity_registry as er
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from .common import MockAlarm
|
||||
|
||||
from tests.common import (
|
||||
MockConfigEntry,
|
||||
async_get_device_automation_capabilities,
|
||||
async_get_device_automations,
|
||||
setup_test_component_platform,
|
||||
)
|
||||
from tests.components.alarm_control_panel.common import MockAlarm
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True, name="stub_blueprint_populate")
|
||||
|
|
|
@ -15,8 +15,9 @@ from homeassistant.config_entries import SOURCE_USER
|
|||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
from . import setup_integration
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
from tests.components.analytics_insights import setup_integration
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
|
|
|
@ -8,8 +8,9 @@ from homeassistant.components.analytics_insights.const import DOMAIN
|
|||
from homeassistant.config_entries import ConfigEntryState
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from . import setup_integration
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
from tests.components.analytics_insights import setup_integration
|
||||
|
||||
|
||||
async def test_load_unload_entry(
|
||||
|
|
|
@ -18,8 +18,9 @@ from homeassistant.const import CONF_EMAIL, CONF_PASSWORD
|
|||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
from .conftest import FIXTURE_USER_INPUT
|
||||
|
||||
from tests.common import MockConfigEntry, async_fire_time_changed
|
||||
from tests.components.aosmith.conftest import FIXTURE_USER_INPUT
|
||||
|
||||
|
||||
async def test_form(hass: HomeAssistant, mock_setup_entry: AsyncMock) -> None:
|
||||
|
|
|
@ -4,7 +4,8 @@ from syrupy.assertion import SnapshotAssertion
|
|||
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from tests.components.apcupsd import async_init_integration
|
||||
from . import async_init_integration
|
||||
|
||||
from tests.components.diagnostics import get_diagnostics_for_config_entry
|
||||
from tests.typing import ClientSessionGenerator
|
||||
|
||||
|
|
|
@ -13,8 +13,9 @@ from homeassistant.components.aquacell.const import (
|
|||
)
|
||||
from homeassistant.const import CONF_EMAIL
|
||||
|
||||
from . import TEST_CONFIG_ENTRY
|
||||
|
||||
from tests.common import MockConfigEntry, load_json_array_fixture
|
||||
from tests.components.aquacell import TEST_CONFIG_ENTRY
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
|
|
|
@ -11,8 +11,9 @@ from homeassistant.const import CONF_EMAIL, CONF_PASSWORD
|
|||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
from . import TEST_CONFIG_ENTRY, TEST_USER_INPUT
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
from tests.components.aquacell import TEST_CONFIG_ENTRY, TEST_USER_INPUT
|
||||
|
||||
|
||||
async def test_config_flow_already_configured(hass: HomeAssistant) -> None:
|
||||
|
|
|
@ -16,8 +16,9 @@ from homeassistant.components.aquacell.const import (
|
|||
from homeassistant.config_entries import ConfigEntryState
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from . import setup_integration
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
from tests.components.aquacell import setup_integration
|
||||
|
||||
|
||||
async def test_load_unload_entry(
|
||||
|
|
|
@ -9,8 +9,9 @@ from syrupy import SnapshotAssertion
|
|||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import entity_registry as er
|
||||
|
||||
from . import setup_integration
|
||||
|
||||
from tests.common import MockConfigEntry, snapshot_platform
|
||||
from tests.components.aquacell import setup_integration
|
||||
|
||||
|
||||
async def test_sensors(
|
||||
|
|
|
@ -11,8 +11,9 @@ from homeassistant.const import CONF_LATITUDE, CONF_LONGITUDE
|
|||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
from . import setup_integration
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
from tests.components.aurora import setup_integration
|
||||
|
||||
DATA = {
|
||||
CONF_LATITUDE: -10,
|
||||
|
|
|
@ -7,7 +7,7 @@ from syrupy.assertion import SnapshotAssertion
|
|||
|
||||
from homeassistant.components.bmw_connected_drive import DOMAIN as BMW_DOMAIN
|
||||
from homeassistant.components.bmw_connected_drive.sensor import SENSOR_TYPES
|
||||
from homeassistant.components.sensor.const import SensorDeviceClass
|
||||
from homeassistant.components.sensor import SensorDeviceClass
|
||||
from homeassistant.const import Platform
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import entity_registry as er
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
"""Test BTHome BLE events."""
|
||||
|
||||
from homeassistant.components import automation
|
||||
from homeassistant.components.bluetooth.const import DOMAIN as BLUETOOTH_DOMAIN
|
||||
from homeassistant.components.bluetooth import DOMAIN as BLUETOOTH_DOMAIN
|
||||
from homeassistant.components.bthome.const import CONF_SUBTYPE, DOMAIN
|
||||
from homeassistant.components.device_automation import DeviceAutomationType
|
||||
from homeassistant.const import CONF_DEVICE_ID, CONF_DOMAIN, CONF_PLATFORM, CONF_TYPE
|
||||
|
|
|
@ -10,8 +10,9 @@ from homeassistant.const import CONF_API_KEY
|
|||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from . import VALID_RESPONSE
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
from tests.components.co2signal import VALID_RESPONSE
|
||||
|
||||
|
||||
@pytest.fixture(name="electricity_maps")
|
||||
|
|
|
@ -12,6 +12,8 @@ from homeassistant.helpers import device_registry as dr, entity_registry as er
|
|||
from homeassistant.helpers.entity_registry import RegistryEntryHider
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from .common import MockCover
|
||||
|
||||
from tests.common import (
|
||||
MockConfigEntry,
|
||||
async_get_device_automation_capabilities,
|
||||
|
@ -19,7 +21,6 @@ from tests.common import (
|
|||
async_mock_service,
|
||||
setup_test_component_platform,
|
||||
)
|
||||
from tests.components.cover.common import MockCover
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True, name="stub_blueprint_populate")
|
||||
|
|
|
@ -20,6 +20,8 @@ from homeassistant.helpers import device_registry as dr, entity_registry as er
|
|||
from homeassistant.helpers.entity_registry import RegistryEntryHider
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from .common import MockCover
|
||||
|
||||
from tests.common import (
|
||||
MockConfigEntry,
|
||||
async_get_device_automation_capabilities,
|
||||
|
@ -27,7 +29,6 @@ from tests.common import (
|
|||
async_mock_service,
|
||||
setup_test_component_platform,
|
||||
)
|
||||
from tests.components.cover.common import MockCover
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True, name="stub_blueprint_populate")
|
||||
|
|
|
@ -22,6 +22,8 @@ from homeassistant.helpers.entity_registry import RegistryEntryHider
|
|||
from homeassistant.setup import async_setup_component
|
||||
import homeassistant.util.dt as dt_util
|
||||
|
||||
from .common import MockCover
|
||||
|
||||
from tests.common import (
|
||||
MockConfigEntry,
|
||||
async_fire_time_changed,
|
||||
|
@ -30,7 +32,6 @@ from tests.common import (
|
|||
async_mock_service,
|
||||
setup_test_component_platform,
|
||||
)
|
||||
from tests.components.cover.common import MockCover
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True, name="stub_blueprint_populate")
|
||||
|
|
|
@ -17,12 +17,13 @@ from homeassistant.const import (
|
|||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from .common import MockCover
|
||||
|
||||
from tests.common import (
|
||||
help_test_all,
|
||||
import_and_test_deprecated_constant_enum,
|
||||
setup_test_component_platform,
|
||||
)
|
||||
from tests.components.cover.common import MockCover
|
||||
|
||||
|
||||
async def test_services(
|
||||
|
|
|
@ -12,8 +12,9 @@ from homeassistant.const import (
|
|||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from .common import MockDateEntity
|
||||
|
||||
from tests.common import setup_test_component_platform
|
||||
from tests.components.date.common import MockDateEntity
|
||||
|
||||
|
||||
async def test_date(hass: HomeAssistant) -> None:
|
||||
|
|
|
@ -10,8 +10,9 @@ from homeassistant.const import ATTR_ENTITY_ID, ATTR_FRIENDLY_NAME, CONF_PLATFOR
|
|||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from .common import MockDateTimeEntity
|
||||
|
||||
from tests.common import setup_test_component_platform
|
||||
from tests.components.datetime.common import MockDateTimeEntity
|
||||
|
||||
DEFAULT_VALUE = datetime(2020, 1, 1, 12, 0, 0, tzinfo=UTC)
|
||||
|
||||
|
|
|
@ -11,8 +11,9 @@ from homeassistant.const import CONF_EMAIL, CONF_PASSWORD
|
|||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from .const import GET_METERS, LAST_READING, LAST_READING_GAS
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
from tests.components.discovergy.const import GET_METERS, LAST_READING, LAST_READING_GAS
|
||||
|
||||
|
||||
def _meter_last_reading(meter_id: str) -> Reading:
|
||||
|
|
|
@ -18,8 +18,8 @@ from homeassistant.components.ecobee.climate import (
|
|||
from homeassistant.const import ATTR_ENTITY_ID, ATTR_SUPPORTED_FEATURES, STATE_OFF
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from tests.components.ecobee import GENERIC_THERMOSTAT_INFO_WITH_HEATPUMP
|
||||
from tests.components.ecobee.common import setup_platform
|
||||
from . import GENERIC_THERMOSTAT_INFO_WITH_HEATPUMP
|
||||
from .common import setup_platform
|
||||
|
||||
ENTITY_ID = "climate.ecobee"
|
||||
|
||||
|
|
|
@ -12,10 +12,9 @@ from homeassistant.components.switch import DOMAIN, SERVICE_TURN_OFF, SERVICE_TU
|
|||
from homeassistant.const import ATTR_ENTITY_ID
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from . import GENERIC_THERMOSTAT_INFO_WITH_HEATPUMP
|
||||
from .common import setup_platform
|
||||
|
||||
from tests.components.ecobee import GENERIC_THERMOSTAT_INFO_WITH_HEATPUMP
|
||||
|
||||
VENTILATOR_20MIN_ID = "switch.ecobee_ventilator_20m_timer"
|
||||
THERMOSTAT_ID = 0
|
||||
|
||||
|
|
|
@ -16,12 +16,13 @@ from homeassistant.core import HomeAssistant
|
|||
import homeassistant.helpers.entity_registry as er
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from .common import MockFan
|
||||
|
||||
from tests.common import (
|
||||
help_test_all,
|
||||
import_and_test_deprecated_constant_enum,
|
||||
setup_test_component_platform,
|
||||
)
|
||||
from tests.components.fan.common import MockFan
|
||||
|
||||
|
||||
class BaseFan(FanEntity):
|
||||
|
|
|
@ -8,8 +8,9 @@ from homeassistant.const import Platform
|
|||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import entity_registry as er
|
||||
|
||||
from . import setup_with_selected_platforms
|
||||
|
||||
from tests.common import MockConfigEntry, snapshot_platform
|
||||
from tests.components.flexit_bacnet import setup_with_selected_platforms
|
||||
|
||||
|
||||
async def test_binary_sensors(
|
||||
|
|
|
@ -8,8 +8,9 @@ from homeassistant.const import Platform
|
|||
from homeassistant.core import HomeAssistant
|
||||
import homeassistant.helpers.entity_registry as er
|
||||
|
||||
from . import setup_with_selected_platforms
|
||||
|
||||
from tests.common import MockConfigEntry, snapshot_platform
|
||||
from tests.components.flexit_bacnet import setup_with_selected_platforms
|
||||
|
||||
|
||||
async def test_climate_entity(
|
||||
|
|
|
@ -7,8 +7,9 @@ from homeassistant.config_entries import ConfigEntryState
|
|||
from homeassistant.const import Platform
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from . import setup_with_selected_platforms
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
from tests.components.flexit_bacnet import setup_with_selected_platforms
|
||||
|
||||
|
||||
async def test_loading_and_unloading_config_entry(
|
||||
|
|
|
@ -13,8 +13,9 @@ from homeassistant.core import HomeAssistant
|
|||
from homeassistant.exceptions import HomeAssistantError
|
||||
from homeassistant.helpers import entity_registry as er
|
||||
|
||||
from . import setup_with_selected_platforms
|
||||
|
||||
from tests.common import MockConfigEntry, snapshot_platform
|
||||
from tests.components.flexit_bacnet import setup_with_selected_platforms
|
||||
|
||||
ENTITY_ID = "number.device_name_fireplace_supply_fan_setpoint"
|
||||
|
||||
|
|
|
@ -8,8 +8,9 @@ from homeassistant.const import Platform
|
|||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import entity_registry as er
|
||||
|
||||
from . import setup_with_selected_platforms
|
||||
|
||||
from tests.common import MockConfigEntry, snapshot_platform
|
||||
from tests.components.flexit_bacnet import setup_with_selected_platforms
|
||||
|
||||
|
||||
async def test_sensors(
|
||||
|
|
|
@ -16,8 +16,9 @@ from homeassistant.core import HomeAssistant
|
|||
from homeassistant.exceptions import HomeAssistantError
|
||||
from homeassistant.helpers import entity_registry as er
|
||||
|
||||
from . import setup_with_selected_platforms
|
||||
|
||||
from tests.common import MockConfigEntry, snapshot_platform
|
||||
from tests.components.flexit_bacnet import setup_with_selected_platforms
|
||||
|
||||
ENTITY_ID = "switch.device_name_electric_heater"
|
||||
|
||||
|
|
|
@ -28,9 +28,10 @@ from homeassistant.core import HomeAssistant
|
|||
from homeassistant.helpers import entity_registry as er
|
||||
from homeassistant.util import dt as dt_util
|
||||
|
||||
from . import _generate_mock_feed_entry
|
||||
from .conftest import URL
|
||||
|
||||
from tests.common import MockConfigEntry, async_fire_time_changed
|
||||
from tests.components.geo_json_events import _generate_mock_feed_entry
|
||||
from tests.components.geo_json_events.conftest import URL
|
||||
|
||||
CONFIG_LEGACY = {
|
||||
GEO_LOCATION_DOMAIN: [
|
||||
|
|
|
@ -7,8 +7,9 @@ from homeassistant.components.geo_location import DOMAIN as GEO_LOCATION_DOMAIN
|
|||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import entity_registry as er
|
||||
|
||||
from . import _generate_mock_feed_entry
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
from tests.components.geo_json_events import _generate_mock_feed_entry
|
||||
|
||||
|
||||
async def test_component_unload_config_entry(
|
||||
|
|
|
@ -19,13 +19,14 @@ from homeassistant.config_entries import ConfigEntryState
|
|||
from homeassistant.core import HomeAssistant, ServiceCall
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from .const import FAKE_BRIDGE, FAKE_BRIDGE_DEVICE
|
||||
|
||||
from tests.common import (
|
||||
MockConfigEntry,
|
||||
async_mock_service,
|
||||
load_fixture,
|
||||
mock_device_registry,
|
||||
)
|
||||
from tests.components.hue.const import FAKE_BRIDGE, FAKE_BRIDGE_DEVICE
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
|
|
|
@ -12,7 +12,7 @@ from homeassistant.const import CONF_LATITUDE, CONF_LONGITUDE, CONF_NAME
|
|||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
from tests.components.ipma import MockLocation
|
||||
from . import MockLocation
|
||||
|
||||
|
||||
@pytest.fixture(name="ipma_setup", autouse=True)
|
||||
|
|
Loading…
Reference in New Issue