Adjusts imports in tests to match our relative import rules (#86788)
parent
89c0b27b42
commit
bfbf9b9751
|
@ -224,7 +224,10 @@ runtime-typing = false
|
|||
max-line-length-suggestions = 72
|
||||
|
||||
[tool.pylint-per-file-ignores]
|
||||
"/tests/"="protected-access,redefined-outer-name"
|
||||
# hass-component-root-import: Tests test non-public APIs
|
||||
# protected-access: Tests do often test internals a lot
|
||||
# redefined-outer-name: Tests reference fixtures in the test function
|
||||
"/tests/"="hass-component-root-import,protected-access,redefined-outer-name"
|
||||
|
||||
[tool.pytest.ini_options]
|
||||
testpaths = [
|
||||
|
|
|
@ -12,9 +12,10 @@ from homeassistant.const import CONF_IP_ADDRESS
|
|||
from homeassistant.data_entry_flow import FlowResultType
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from ...common import MockConfigEntry
|
||||
from .conftest import mock_config, mock_feature, mock_only_feature, setup_product_mock
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
|
||||
def create_valid_feature_mock(path="homeassistant.components.blebox.Products"):
|
||||
"""Return a valid, complete BleBox feature mock."""
|
||||
|
|
|
@ -6,11 +6,7 @@ from unittest.mock import _patch, patch
|
|||
|
||||
from aioruuvigateway.models import HistoryResponse
|
||||
|
||||
from tests.components.ruuvi_gateway.consts import (
|
||||
ASYNC_SETUP_ENTRY,
|
||||
GATEWAY_MAC,
|
||||
GET_GATEWAY_HISTORY_DATA,
|
||||
)
|
||||
from .consts import ASYNC_SETUP_ENTRY, GATEWAY_MAC, GET_GATEWAY_HISTORY_DATA
|
||||
|
||||
|
||||
def patch_gateway_ok() -> _patch:
|
||||
|
|
|
@ -9,17 +9,13 @@ from homeassistant.core import HomeAssistant
|
|||
from homeassistant.helpers import device_registry as dr
|
||||
|
||||
from .api_responses import TEST_VIN_2_EV
|
||||
from .conftest import MOCK_API_FETCH, MOCK_API_GET_DATA, advance_time_to_next_fetch
|
||||
|
||||
from tests.common import load_fixture
|
||||
from tests.components.diagnostics import (
|
||||
get_diagnostics_for_config_entry,
|
||||
get_diagnostics_for_device,
|
||||
)
|
||||
from tests.components.subaru.conftest import (
|
||||
MOCK_API_FETCH,
|
||||
MOCK_API_GET_DATA,
|
||||
advance_time_to_next_fetch,
|
||||
)
|
||||
|
||||
|
||||
async def test_config_entry_diagnostics(hass: HomeAssistant, hass_client, ev_entry):
|
||||
|
|
|
@ -54,11 +54,11 @@ from homeassistant.helpers.typing import ConfigType
|
|||
from homeassistant.setup import async_setup_component
|
||||
from homeassistant.util import dt as dt_util, location
|
||||
|
||||
from tests.ignore_uncaught_exceptions import IGNORE_UNCAUGHT_EXCEPTIONS
|
||||
from .ignore_uncaught_exceptions import IGNORE_UNCAUGHT_EXCEPTIONS
|
||||
|
||||
pytest.register_assert_rewrite("tests.common")
|
||||
|
||||
from tests.common import ( # noqa: E402, isort:skip
|
||||
from .common import ( # noqa: E402, isort:skip
|
||||
CLIENT_ID,
|
||||
INSTANCES,
|
||||
MockConfigEntry,
|
||||
|
@ -70,7 +70,7 @@ from tests.common import ( # noqa: E402, isort:skip
|
|||
init_recorder_component,
|
||||
mock_storage as mock_storage,
|
||||
)
|
||||
from tests.test_util.aiohttp import mock_aiohttp_client # noqa: E402, isort:skip
|
||||
from .test_util.aiohttp import mock_aiohttp_client # noqa: E402, isort:skip
|
||||
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
@ -1062,7 +1062,7 @@ async def async_setup_recorder_instance(
|
|||
# testcase which does not use the recorder.
|
||||
from homeassistant.components import recorder
|
||||
|
||||
from tests.components.recorder.common import async_recorder_block_till_done
|
||||
from .components.recorder.common import async_recorder_block_till_done
|
||||
|
||||
nightly = recorder.Recorder.async_nightly_tasks if enable_nightly_purge else None
|
||||
stats = recorder.Recorder.async_periodic_statistics if enable_statistics else None
|
||||
|
|
|
@ -13,7 +13,7 @@ from homeassistant.const import SIGNAL_BOOTSTRAP_INTEGRATIONS
|
|||
from homeassistant.exceptions import HomeAssistantError
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
|
||||
from tests.common import (
|
||||
from .common import (
|
||||
MockModule,
|
||||
MockPlatform,
|
||||
get_test_config_dir,
|
||||
|
|
|
@ -40,7 +40,7 @@ from homeassistant.util.unit_system import (
|
|||
)
|
||||
from homeassistant.util.yaml import SECRET_YAML
|
||||
|
||||
from tests.common import MockUser, get_test_config_dir, patch_yaml_files
|
||||
from .common import MockUser, get_test_config_dir, patch_yaml_files
|
||||
|
||||
CONFIG_DIR = get_test_config_dir()
|
||||
YAML_PATH = os.path.join(CONFIG_DIR, config_util.YAML_CONFIG_FILE)
|
||||
|
|
|
@ -29,7 +29,7 @@ from homeassistant.helpers.update_coordinator import DataUpdateCoordinator
|
|||
from homeassistant.setup import async_set_domains_to_be_loaded, async_setup_component
|
||||
from homeassistant.util import dt
|
||||
|
||||
from tests.common import (
|
||||
from .common import (
|
||||
MockConfigEntry,
|
||||
MockEntity,
|
||||
MockModule,
|
||||
|
|
|
@ -43,7 +43,7 @@ import homeassistant.util.dt as dt_util
|
|||
from homeassistant.util.read_only_dict import ReadOnlyDict
|
||||
from homeassistant.util.unit_system import METRIC_SYSTEM
|
||||
|
||||
from tests.common import async_capture_events, async_mock_service
|
||||
from .common import async_capture_events, async_mock_service
|
||||
|
||||
PST = dt_util.get_time_zone("America/Los_Angeles")
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ from homeassistant import config_entries, data_entry_flow
|
|||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.util.decorator import Registry
|
||||
|
||||
from tests.common import async_capture_events
|
||||
from .common import async_capture_events
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
|
|
|
@ -7,7 +7,7 @@ from homeassistant import core, loader
|
|||
from homeassistant.components import http, hue
|
||||
from homeassistant.components.hue import light as hue_light
|
||||
|
||||
from tests.common import MockModule, mock_integration
|
||||
from .common import MockModule, mock_integration
|
||||
|
||||
|
||||
async def test_component_dependencies(hass):
|
||||
|
|
|
@ -14,7 +14,7 @@ from homeassistant.requirements import (
|
|||
async_process_requirements,
|
||||
)
|
||||
|
||||
from tests.common import MockModule, mock_integration
|
||||
from .common import MockModule, mock_integration
|
||||
|
||||
|
||||
def env_without_wheel_links():
|
||||
|
|
|
@ -18,7 +18,7 @@ from homeassistant.helpers.config_validation import (
|
|||
PLATFORM_SCHEMA_BASE,
|
||||
)
|
||||
|
||||
from tests.common import (
|
||||
from .common import (
|
||||
MockConfigEntry,
|
||||
MockModule,
|
||||
MockPlatform,
|
||||
|
|
Loading…
Reference in New Issue