Apply hass-relative-import to tests (s-z) (#78733)
This commit is contained in:
parent
c5a56dab42
commit
e9f55f4e54
39 changed files with 63 additions and 84 deletions
|
@ -14,7 +14,7 @@ import voluptuous as vol
|
|||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from tests.components.signal_messenger.conftest import (
|
||||
from .conftest import (
|
||||
CONTENT,
|
||||
MESSAGE,
|
||||
NUMBER_FROM,
|
||||
|
|
|
@ -9,7 +9,7 @@ from homeassistant.const import (
|
|||
)
|
||||
from homeassistant.helpers import entity_registry as er
|
||||
|
||||
from tests.components.sleepiq.conftest import (
|
||||
from .conftest import (
|
||||
BED_NAME,
|
||||
BED_NAME_LOWER,
|
||||
SLEEPER_L_ID,
|
||||
|
|
|
@ -3,12 +3,7 @@ from homeassistant.components.button import DOMAIN
|
|||
from homeassistant.const import ATTR_ENTITY_ID, ATTR_FRIENDLY_NAME
|
||||
from homeassistant.helpers import entity_registry as er
|
||||
|
||||
from tests.components.sleepiq.conftest import (
|
||||
BED_ID,
|
||||
BED_NAME,
|
||||
BED_NAME_LOWER,
|
||||
setup_platform,
|
||||
)
|
||||
from .conftest import BED_ID, BED_NAME, BED_NAME_LOWER, setup_platform
|
||||
|
||||
|
||||
async def test_button_calibrate(hass, mock_asyncsleepiq):
|
||||
|
|
|
@ -9,7 +9,7 @@ from homeassistant.components.sleepiq.const import DOMAIN
|
|||
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from tests.components.sleepiq.conftest import SLEEPIQ_CONFIG, setup_platform
|
||||
from .conftest import SLEEPIQ_CONFIG, setup_platform
|
||||
|
||||
|
||||
async def test_import(hass: HomeAssistant) -> None:
|
||||
|
|
|
@ -19,8 +19,7 @@ from homeassistant.helpers import entity_registry as er
|
|||
from homeassistant.setup import async_setup_component
|
||||
from homeassistant.util.dt import utcnow
|
||||
|
||||
from tests.common import MockConfigEntry, async_fire_time_changed, mock_registry
|
||||
from tests.components.sleepiq.conftest import (
|
||||
from .conftest import (
|
||||
BED_ID,
|
||||
SLEEPER_L_ID,
|
||||
SLEEPER_L_NAME,
|
||||
|
@ -29,6 +28,8 @@ from tests.components.sleepiq.conftest import (
|
|||
setup_platform,
|
||||
)
|
||||
|
||||
from tests.common import MockConfigEntry, async_fire_time_changed, mock_registry
|
||||
|
||||
ENTITY_IS_IN_BED = f"sensor.sleepnumber_{BED_ID}_{SLEEPER_L_NAME_LOWER}_{IS_IN_BED}"
|
||||
ENTITY_PRESSURE = f"sensor.sleepnumber_{BED_ID}_{SLEEPER_L_NAME_LOWER}_{PRESSURE}"
|
||||
ENTITY_SLEEP_NUMBER = (
|
||||
|
|
|
@ -5,13 +5,9 @@ from homeassistant.const import ATTR_ENTITY_ID, STATE_OFF, STATE_ON
|
|||
from homeassistant.helpers import entity_registry as er
|
||||
from homeassistant.util.dt import utcnow
|
||||
|
||||
from .conftest import BED_ID, BED_NAME, BED_NAME_LOWER, setup_platform
|
||||
|
||||
from tests.common import async_fire_time_changed
|
||||
from tests.components.sleepiq.conftest import (
|
||||
BED_ID,
|
||||
BED_NAME,
|
||||
BED_NAME_LOWER,
|
||||
setup_platform,
|
||||
)
|
||||
|
||||
|
||||
async def test_setup(hass, mock_asyncsleepiq):
|
||||
|
|
|
@ -10,7 +10,7 @@ from homeassistant.components.number.const import (
|
|||
from homeassistant.const import ATTR_ENTITY_ID, ATTR_FRIENDLY_NAME, ATTR_ICON
|
||||
from homeassistant.helpers import entity_registry as er
|
||||
|
||||
from tests.components.sleepiq.conftest import (
|
||||
from .conftest import (
|
||||
BED_ID,
|
||||
BED_NAME,
|
||||
BED_NAME_LOWER,
|
||||
|
|
|
@ -11,7 +11,7 @@ from homeassistant.const import (
|
|||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import entity_registry as er
|
||||
|
||||
from tests.components.sleepiq.conftest import (
|
||||
from .conftest import (
|
||||
BED_ID,
|
||||
BED_NAME,
|
||||
BED_NAME_LOWER,
|
||||
|
|
|
@ -3,7 +3,7 @@ from homeassistant.components.sensor import DOMAIN
|
|||
from homeassistant.const import ATTR_FRIENDLY_NAME, ATTR_ICON
|
||||
from homeassistant.helpers import entity_registry as er
|
||||
|
||||
from tests.components.sleepiq.conftest import (
|
||||
from .conftest import (
|
||||
BED_NAME,
|
||||
BED_NAME_LOWER,
|
||||
SLEEPER_L_ID,
|
||||
|
|
|
@ -5,13 +5,9 @@ from homeassistant.const import ATTR_ENTITY_ID, STATE_OFF, STATE_ON
|
|||
from homeassistant.helpers import entity_registry as er
|
||||
from homeassistant.util.dt import utcnow
|
||||
|
||||
from .conftest import BED_ID, BED_NAME, BED_NAME_LOWER, setup_platform
|
||||
|
||||
from tests.common import async_fire_time_changed
|
||||
from tests.components.sleepiq.conftest import (
|
||||
BED_ID,
|
||||
BED_NAME,
|
||||
BED_NAME_LOWER,
|
||||
setup_platform,
|
||||
)
|
||||
|
||||
|
||||
async def test_setup(hass, mock_asyncsleepiq):
|
||||
|
|
|
@ -15,8 +15,9 @@ from homeassistant.const import CONF_API_KEY, CONF_SOURCE, CONF_URL, CONF_VERIFY
|
|||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
from . import MOCK_REAUTH_INPUT, MOCK_USER_INPUT
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
from tests.components.sonarr import MOCK_REAUTH_INPUT, MOCK_USER_INPUT
|
||||
|
||||
|
||||
async def test_show_user_form(hass: HomeAssistant) -> None:
|
||||
|
|
|
@ -3,7 +3,7 @@ from unittest.mock import patch
|
|||
|
||||
import pytest
|
||||
|
||||
from tests.components.speedtestdotnet import MOCK_RESULTS, MOCK_SERVERS
|
||||
from . import MOCK_RESULTS, MOCK_SERVERS
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
from homeassistant import config_entries
|
||||
from homeassistant.components import srp_energy
|
||||
|
||||
from tests.components.srp_energy import init_integration
|
||||
from . import init_integration
|
||||
|
||||
|
||||
async def test_setup_entry(hass):
|
||||
|
|
|
@ -20,13 +20,14 @@ from homeassistant.components.stream.core import Part
|
|||
from homeassistant.setup import async_setup_component
|
||||
import homeassistant.util.dt as dt_util
|
||||
|
||||
from tests.common import async_fire_time_changed
|
||||
from tests.components.stream.common import (
|
||||
from .common import (
|
||||
FAKE_TIME,
|
||||
DefaultSegment as Segment,
|
||||
assert_mp4_has_transform_matrix,
|
||||
)
|
||||
|
||||
from tests.common import async_fire_time_changed
|
||||
|
||||
STREAM_SOURCE = "some-stream-source"
|
||||
INIT_BYTES = b"init"
|
||||
FAKE_PAYLOAD = b"fake-payload"
|
||||
|
|
|
@ -22,14 +22,9 @@ from homeassistant.components.stream.const import (
|
|||
from homeassistant.components.stream.core import Part
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from .common import FAKE_TIME, DefaultSegment as Segment, generate_h264_video
|
||||
from .test_hls import STREAM_SOURCE, HlsClient, make_playlist
|
||||
|
||||
from tests.components.stream.common import (
|
||||
FAKE_TIME,
|
||||
DefaultSegment as Segment,
|
||||
generate_h264_video,
|
||||
)
|
||||
|
||||
SEGMENT_DURATION = 6
|
||||
TEST_PART_DURATION = 0.75
|
||||
NUM_PART_SEGMENTS = int(-(-SEGMENT_DURATION // TEST_PART_DURATION))
|
||||
|
|
|
@ -48,9 +48,10 @@ from homeassistant.components.stream.worker import (
|
|||
)
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from .common import generate_h264_video, generate_h265_video
|
||||
from .test_ll_hls import TEST_PART_DURATION
|
||||
|
||||
from tests.components.camera.common import EMPTY_8_6_JPEG, mock_turbo_jpeg
|
||||
from tests.components.stream.common import generate_h264_video, generate_h265_video
|
||||
from tests.components.stream.test_ll_hls import TEST_PART_DURATION
|
||||
|
||||
STREAM_SOURCE = "some-stream-source"
|
||||
# Formats here are arbitrary, not exercised by tests
|
||||
|
|
|
@ -20,12 +20,7 @@ from .api_responses import (
|
|||
VEHICLE_DATA,
|
||||
VEHICLE_STATUS_EV,
|
||||
)
|
||||
|
||||
from tests.components.subaru.conftest import (
|
||||
MOCK_API_FETCH,
|
||||
MOCK_API_GET_DATA,
|
||||
advance_time_to_next_fetch,
|
||||
)
|
||||
from .conftest import MOCK_API_FETCH, MOCK_API_GET_DATA, advance_time_to_next_fetch
|
||||
|
||||
VEHICLE_NAME = VEHICLE_DATA[TEST_VIN_2_EV][VEHICLE_NAME]
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ from homeassistant.components import switch
|
|||
from homeassistant.const import CONF_PLATFORM
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from tests.components.switch import common
|
||||
from . import common
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
|
|
|
@ -6,8 +6,9 @@ from homeassistant.components.light import (
|
|||
)
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from . import common as switch_common
|
||||
|
||||
from tests.components.light import common
|
||||
from tests.components.switch import common as switch_common
|
||||
|
||||
|
||||
async def test_default_state(hass):
|
||||
|
|
|
@ -8,8 +8,9 @@ from homeassistant.const import STATE_OFF, STATE_ON
|
|||
from homeassistant.setup import async_setup_component
|
||||
from homeassistant.util.dt import utcnow
|
||||
|
||||
from . import test_sensor as test_tcp
|
||||
|
||||
from tests.common import assert_setup_component, async_fire_time_changed
|
||||
import tests.components.tcp.test_sensor as test_tcp
|
||||
|
||||
BINARY_SENSOR_CONFIG = test_tcp.TEST_CONFIG["sensor"]
|
||||
TEST_CONFIG = {"binary_sensor": BINARY_SENSOR_CONFIG}
|
||||
|
|
|
@ -13,13 +13,9 @@ from homeassistant.config_entries import ConfigEntryState
|
|||
from homeassistant.const import CONF_MODEL
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from . import TEST_HOST, TEST_MODEL, TEST_NAME_ORIGINAL, ClientMock
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
from tests.components.twinkly import (
|
||||
TEST_HOST,
|
||||
TEST_MODEL,
|
||||
TEST_NAME_ORIGINAL,
|
||||
ClientMock,
|
||||
)
|
||||
|
||||
|
||||
async def test_load_unload_entry(hass: HomeAssistant):
|
||||
|
|
|
@ -16,8 +16,9 @@ from homeassistant.helpers import device_registry as dr, entity_registry as er
|
|||
from homeassistant.helpers.device_registry import DeviceEntry
|
||||
from homeassistant.helpers.entity_registry import RegistryEntry
|
||||
|
||||
from . import TEST_MODEL, TEST_NAME_ORIGINAL, ClientMock
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
from tests.components.twinkly import TEST_MODEL, TEST_NAME_ORIGINAL, ClientMock
|
||||
|
||||
|
||||
async def test_initial_state(hass: HomeAssistant):
|
||||
|
|
|
@ -8,8 +8,9 @@ from homeassistant.config_entries import ConfigEntry
|
|||
from homeassistant.const import CONF_NAME, CONF_PORT
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from .const import PORT_TCP
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
from tests.components.velbus.const import PORT_TCP
|
||||
|
||||
|
||||
@pytest.fixture(name="controller")
|
||||
|
|
|
@ -18,7 +18,7 @@ from homeassistant.components.wallbox.const import (
|
|||
)
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from tests.components.wallbox import (
|
||||
from . import (
|
||||
authorisation_response,
|
||||
authorisation_response_unauthorised,
|
||||
entry,
|
||||
|
|
|
@ -7,15 +7,14 @@ from homeassistant.components.wallbox import CHARGER_MAX_CHARGING_CURRENT_KEY
|
|||
from homeassistant.config_entries import ConfigEntryState
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from . import test_response
|
||||
|
||||
from tests.components.wallbox import (
|
||||
from . import (
|
||||
DOMAIN,
|
||||
authorisation_response,
|
||||
entry,
|
||||
setup_integration,
|
||||
setup_integration_connection_error,
|
||||
setup_integration_read_only,
|
||||
test_response,
|
||||
)
|
||||
|
||||
|
||||
|
|
|
@ -9,13 +9,13 @@ from homeassistant.components.wallbox import CHARGER_LOCKED_UNLOCKED_KEY
|
|||
from homeassistant.const import ATTR_ENTITY_ID
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from tests.components.wallbox import (
|
||||
from . import (
|
||||
authorisation_response,
|
||||
entry,
|
||||
setup_integration,
|
||||
setup_integration_read_only,
|
||||
)
|
||||
from tests.components.wallbox.const import MOCK_LOCK_ENTITY_ID
|
||||
from .const import MOCK_LOCK_ENTITY_ID
|
||||
|
||||
|
||||
async def test_wallbox_lock_class(hass: HomeAssistant) -> None:
|
||||
|
|
|
@ -9,8 +9,8 @@ from homeassistant.components.wallbox import CHARGER_MAX_CHARGING_CURRENT_KEY
|
|||
from homeassistant.const import ATTR_ENTITY_ID
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from tests.components.wallbox import authorisation_response, entry, setup_integration
|
||||
from tests.components.wallbox.const import MOCK_NUMBER_ENTITY_ID
|
||||
from . import authorisation_response, entry, setup_integration
|
||||
from .const import MOCK_NUMBER_ENTITY_ID
|
||||
|
||||
|
||||
async def test_wallbox_number_class(hass: HomeAssistant) -> None:
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
from homeassistant.const import CONF_ICON, CONF_UNIT_OF_MEASUREMENT, POWER_KILO_WATT
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from tests.components.wallbox import entry, setup_integration
|
||||
from tests.components.wallbox.const import (
|
||||
from . import entry, setup_integration
|
||||
from .const import (
|
||||
MOCK_SENSOR_CHARGING_POWER_ID,
|
||||
MOCK_SENSOR_CHARGING_SPEED_ID,
|
||||
MOCK_SENSOR_MAX_AVAILABLE_POWER,
|
||||
|
|
|
@ -10,8 +10,8 @@ from homeassistant.components.wallbox.const import CHARGER_STATUS_ID_KEY
|
|||
from homeassistant.const import ATTR_ENTITY_ID
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from tests.components.wallbox import authorisation_response, entry, setup_integration
|
||||
from tests.components.wallbox.const import MOCK_SWITCH_ENTITY_ID
|
||||
from . import authorisation_response, entry, setup_integration
|
||||
from .const import MOCK_SWITCH_ENTITY_ID
|
||||
|
||||
|
||||
async def test_wallbox_switch_class(hass: HomeAssistant) -> None:
|
||||
|
|
|
@ -7,7 +7,7 @@ from homeassistant.components.whirlpool.const import DOMAIN
|
|||
from homeassistant.config_entries import ConfigEntryState
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from tests.components.whirlpool import init_integration
|
||||
from . import init_integration
|
||||
|
||||
|
||||
async def test_setup(hass: HomeAssistant):
|
||||
|
|
|
@ -14,8 +14,7 @@ from homeassistant.const import CONF_HOST, CONF_NAME, CONF_SOURCE
|
|||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
from tests.components.wilight import (
|
||||
from . import (
|
||||
CONF_COMPONENTS,
|
||||
HOST,
|
||||
MOCK_SSDP_DISCOVERY_INFO_MISSING_MANUFACTURER,
|
||||
|
@ -26,6 +25,8 @@ from tests.components.wilight import (
|
|||
WILIGHT_ID,
|
||||
)
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
|
||||
@pytest.fixture(name="dummy_get_components_from_model_clear")
|
||||
def mock_dummy_get_components_from_model_clear():
|
||||
|
|
|
@ -9,7 +9,7 @@ import requests
|
|||
from homeassistant.config_entries import ConfigEntryState
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from tests.components.wilight import (
|
||||
from . import (
|
||||
HOST,
|
||||
UPNP_MAC_ADDRESS,
|
||||
UPNP_MODEL_NAME_P_B,
|
||||
|
|
|
@ -19,7 +19,7 @@ from homeassistant.const import (
|
|||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import entity_registry as er
|
||||
|
||||
from tests.components.wilight import (
|
||||
from . import (
|
||||
HOST,
|
||||
UPNP_MAC_ADDRESS,
|
||||
UPNP_MODEL_NAME_COLOR,
|
||||
|
|
|
@ -19,12 +19,9 @@ from homeassistant.components.withings.common import (
|
|||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.config_entry_oauth2_flow import AbstractOAuth2Implementation
|
||||
|
||||
from .common import ComponentFactory, get_data_manager_by_user_id, new_profile_config
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
from tests.components.withings.common import (
|
||||
ComponentFactory,
|
||||
get_data_manager_by_user_id,
|
||||
new_profile_config,
|
||||
)
|
||||
from tests.test_util.aiohttp import AiohttpClientMocker
|
||||
|
||||
|
||||
|
|
|
@ -32,8 +32,9 @@ from homeassistant.const import (
|
|||
)
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from . import TEST_MAC
|
||||
|
||||
from tests.common import MockConfigEntry, async_fire_time_changed
|
||||
from tests.components.xiaomi_miio import TEST_MAC
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
|
|
|
@ -20,9 +20,10 @@ import homeassistant.components.zha.core.const as zha_const
|
|||
import homeassistant.components.zha.core.device as zha_core_device
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from . import common
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
from tests.components.light.conftest import mock_light_profiles # noqa: F401
|
||||
from tests.components.zha import common
|
||||
|
||||
FIXTURE_GRP_ID = 0x1001
|
||||
FIXTURE_GRP_NAME = "fixture group"
|
||||
|
|
|
@ -39,14 +39,13 @@ from .common import (
|
|||
async_enable_traffic,
|
||||
async_find_group_entity_id,
|
||||
async_test_rejoin,
|
||||
async_wait_for_updates,
|
||||
find_entity_id,
|
||||
get_zha_gateway,
|
||||
send_attributes_report,
|
||||
)
|
||||
from .conftest import SIG_EP_INPUT, SIG_EP_OUTPUT, SIG_EP_PROFILE, SIG_EP_TYPE
|
||||
|
||||
from tests.components.zha.common import async_wait_for_updates
|
||||
|
||||
IEEE_GROUPABLE_DEVICE = "01:2d:6f:00:0a:90:69:e8"
|
||||
IEEE_GROUPABLE_DEVICE2 = "02:2d:6f:00:0a:90:69:e8"
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@ from .common import (
|
|||
async_find_group_entity_id,
|
||||
async_shift_time,
|
||||
async_test_rejoin,
|
||||
async_wait_for_updates,
|
||||
find_entity_id,
|
||||
get_zha_gateway,
|
||||
patch_zha_config,
|
||||
|
@ -36,7 +37,6 @@ from .common import (
|
|||
from .conftest import SIG_EP_INPUT, SIG_EP_OUTPUT, SIG_EP_PROFILE, SIG_EP_TYPE
|
||||
|
||||
from tests.common import async_fire_time_changed
|
||||
from tests.components.zha.common import async_wait_for_updates
|
||||
|
||||
IEEE_GROUPABLE_DEVICE = "01:2d:6f:00:0a:90:69:e8"
|
||||
IEEE_GROUPABLE_DEVICE2 = "02:2d:6f:00:0a:90:69:e9"
|
||||
|
|
|
@ -26,6 +26,7 @@ from .common import (
|
|||
async_enable_traffic,
|
||||
async_find_group_entity_id,
|
||||
async_test_rejoin,
|
||||
async_wait_for_updates,
|
||||
find_entity_id,
|
||||
get_zha_gateway,
|
||||
send_attributes_report,
|
||||
|
@ -33,7 +34,6 @@ from .common import (
|
|||
from .conftest import SIG_EP_INPUT, SIG_EP_OUTPUT, SIG_EP_TYPE
|
||||
|
||||
from tests.common import mock_coro
|
||||
from tests.components.zha.common import async_wait_for_updates
|
||||
|
||||
ON = 1
|
||||
OFF = 0
|
||||
|
|
Loading…
Add table
Reference in a new issue