mirror of https://github.com/home-assistant/core
Update import locations in tests (#122216)
This commit is contained in:
parent
0637e342f6
commit
a6068dcdf2
tests
auth/providers
components
config
conversation
esphome
fido
google_assistant
homeassistant_sky_connect
homekit
http
intent_script
mailbox
melnor
plex
recorder
test_filters.pytest_filters_with_entityfilter.pytest_filters_with_entityfilter_schema_37.pytest_v32_migration.py
rflink
schedule
script
snips
spc
startca
synology_dsm
system_log
template
trace
websocket_api
helpers
test_aiohttp_client.pytest_discovery_flow.pytest_entity.pytest_entity_platform.pytest_httpx_client.pytest_integration_platform.pytest_script_variables.py
test_bootstrap.pytest_config.pytest_core.pytest_runner.pyutil/yaml
|
@ -189,11 +189,11 @@ async def test_validate_access(provider: tn_auth.TrustedNetworksAuthProvider) ->
|
|||
provider.async_validate_access(ip_address("::1"))
|
||||
provider.async_validate_access(ip_address("fd01:db8::ff00:42:8329"))
|
||||
|
||||
with pytest.raises(tn_auth.InvalidAuthError):
|
||||
with pytest.raises(auth.InvalidAuthError):
|
||||
provider.async_validate_access(ip_address("192.168.0.2"))
|
||||
with pytest.raises(tn_auth.InvalidAuthError):
|
||||
with pytest.raises(auth.InvalidAuthError):
|
||||
provider.async_validate_access(ip_address("127.0.0.1"))
|
||||
with pytest.raises(tn_auth.InvalidAuthError):
|
||||
with pytest.raises(auth.InvalidAuthError):
|
||||
provider.async_validate_access(ip_address("2001:db8::ff00:42:8329"))
|
||||
|
||||
|
||||
|
@ -214,11 +214,11 @@ async def test_validate_access_proxy(
|
|||
)
|
||||
provider.async_validate_access(ip_address("192.168.128.2"))
|
||||
provider.async_validate_access(ip_address("fd00::2"))
|
||||
with pytest.raises(tn_auth.InvalidAuthError):
|
||||
with pytest.raises(auth.InvalidAuthError):
|
||||
provider.async_validate_access(ip_address("192.168.128.0"))
|
||||
with pytest.raises(tn_auth.InvalidAuthError):
|
||||
with pytest.raises(auth.InvalidAuthError):
|
||||
provider.async_validate_access(ip_address("192.168.128.1"))
|
||||
with pytest.raises(tn_auth.InvalidAuthError):
|
||||
with pytest.raises(auth.InvalidAuthError):
|
||||
provider.async_validate_access(ip_address("fd00::1"))
|
||||
|
||||
|
||||
|
@ -241,7 +241,7 @@ async def test_validate_access_cloud(
|
|||
provider.async_validate_access(ip_address("192.168.128.2"))
|
||||
|
||||
remote.is_cloud_request.set(True)
|
||||
with pytest.raises(tn_auth.InvalidAuthError):
|
||||
with pytest.raises(auth.InvalidAuthError):
|
||||
provider.async_validate_access(ip_address("192.168.128.2"))
|
||||
|
||||
|
||||
|
@ -250,7 +250,7 @@ async def test_validate_refresh_token(
|
|||
) -> None:
|
||||
"""Verify re-validation of refresh token."""
|
||||
with patch.object(provider, "async_validate_access") as mock:
|
||||
with pytest.raises(tn_auth.InvalidAuthError):
|
||||
with pytest.raises(auth.InvalidAuthError):
|
||||
provider.async_validate_refresh_token(Mock(), None)
|
||||
|
||||
provider.async_validate_refresh_token(Mock(), "127.0.0.1")
|
||||
|
|
|
@ -7,12 +7,12 @@ from unittest.mock import patch
|
|||
|
||||
import pytest
|
||||
|
||||
from homeassistant.bootstrap import async_setup_component
|
||||
from homeassistant.components import config
|
||||
from homeassistant.components.config import automation
|
||||
from homeassistant.const import STATE_ON
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import entity_registry as er
|
||||
from homeassistant.setup import async_setup_component
|
||||
from homeassistant.util import yaml
|
||||
|
||||
from tests.typing import ClientSessionGenerator
|
||||
|
|
|
@ -5,11 +5,11 @@ from unittest.mock import Mock, patch
|
|||
|
||||
import pytest
|
||||
|
||||
from homeassistant.bootstrap import async_setup_component
|
||||
from homeassistant.components import config
|
||||
from homeassistant.components.config import core
|
||||
from homeassistant.components.websocket_api import TYPE_RESULT
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.setup import async_setup_component
|
||||
from homeassistant.util import dt as dt_util, location
|
||||
from homeassistant.util.unit_system import US_CUSTOMARY_SYSTEM
|
||||
|
||||
|
|
|
@ -7,11 +7,11 @@ from unittest.mock import ANY, patch
|
|||
|
||||
import pytest
|
||||
|
||||
from homeassistant.bootstrap import async_setup_component
|
||||
from homeassistant.components import config
|
||||
from homeassistant.components.config import scene
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import entity_registry as er
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from tests.typing import ClientSessionGenerator
|
||||
|
||||
|
|
|
@ -7,12 +7,12 @@ from unittest.mock import patch
|
|||
|
||||
import pytest
|
||||
|
||||
from homeassistant.bootstrap import async_setup_component
|
||||
from homeassistant.components import config
|
||||
from homeassistant.components.config import script
|
||||
from homeassistant.const import STATE_OFF, STATE_UNAVAILABLE
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import entity_registry as er
|
||||
from homeassistant.setup import async_setup_component
|
||||
from homeassistant.util import yaml
|
||||
|
||||
from tests.typing import ClientSessionGenerator
|
||||
|
|
|
@ -30,12 +30,12 @@ from homeassistant.const import (
|
|||
STATE_CLOSED,
|
||||
STATE_ON,
|
||||
STATE_UNKNOWN,
|
||||
EntityCategory,
|
||||
)
|
||||
from homeassistant.core import DOMAIN as HASS_DOMAIN, Context, HomeAssistant, callback
|
||||
from homeassistant.helpers import (
|
||||
area_registry as ar,
|
||||
device_registry as dr,
|
||||
entity,
|
||||
entity_registry as er,
|
||||
floor_registry as fr,
|
||||
intent,
|
||||
|
@ -79,8 +79,8 @@ async def init_components(hass: HomeAssistant) -> None:
|
|||
[
|
||||
{"hidden_by": er.RegistryEntryHider.USER},
|
||||
{"hidden_by": er.RegistryEntryHider.INTEGRATION},
|
||||
{"entity_category": entity.EntityCategory.CONFIG},
|
||||
{"entity_category": entity.EntityCategory.DIAGNOSTIC},
|
||||
{"entity_category": EntityCategory.CONFIG},
|
||||
{"entity_category": EntityCategory.DIAGNOSTIC},
|
||||
],
|
||||
)
|
||||
@pytest.mark.usefixtures("init_components")
|
||||
|
|
|
@ -28,10 +28,10 @@ from homeassistant.const import (
|
|||
ATTR_ICON,
|
||||
ATTR_UNIT_OF_MEASUREMENT,
|
||||
STATE_UNKNOWN,
|
||||
EntityCategory,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import entity_registry as er
|
||||
from homeassistant.helpers.entity import EntityCategory
|
||||
|
||||
from .conftest import MockESPHomeDevice
|
||||
|
||||
|
|
|
@ -6,9 +6,9 @@ from unittest.mock import MagicMock, patch
|
|||
from pyfido.client import PyFidoError
|
||||
import pytest
|
||||
|
||||
from homeassistant.bootstrap import async_setup_component
|
||||
from homeassistant.components.fido import sensor as fido
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from tests.common import assert_setup_component
|
||||
|
||||
|
|
|
@ -25,11 +25,12 @@ from homeassistant.components.google_assistant import (
|
|||
from homeassistant.config import async_process_ha_core_config
|
||||
from homeassistant.const import (
|
||||
ATTR_UNIT_OF_MEASUREMENT,
|
||||
EVENT_CALL_SERVICE,
|
||||
Platform,
|
||||
UnitOfTemperature,
|
||||
__version__,
|
||||
)
|
||||
from homeassistant.core import EVENT_CALL_SERVICE, HomeAssistant, State
|
||||
from homeassistant.core import HomeAssistant, State
|
||||
from homeassistant.helpers import (
|
||||
area_registry as ar,
|
||||
device_registry as dr,
|
||||
|
|
|
@ -60,6 +60,7 @@ from homeassistant.const import (
|
|||
ATTR_MODE,
|
||||
ATTR_SUPPORTED_FEATURES,
|
||||
ATTR_TEMPERATURE,
|
||||
EVENT_CALL_SERVICE,
|
||||
SERVICE_TURN_OFF,
|
||||
SERVICE_TURN_ON,
|
||||
STATE_ALARM_ARMED_AWAY,
|
||||
|
@ -75,12 +76,7 @@ from homeassistant.const import (
|
|||
STATE_UNKNOWN,
|
||||
UnitOfTemperature,
|
||||
)
|
||||
from homeassistant.core import (
|
||||
DOMAIN as HA_DOMAIN,
|
||||
EVENT_CALL_SERVICE,
|
||||
HomeAssistant,
|
||||
State,
|
||||
)
|
||||
from homeassistant.core import DOMAIN as HA_DOMAIN, HomeAssistant, State
|
||||
from homeassistant.util import color, dt as dt_util
|
||||
from homeassistant.util.unit_conversion import TemperatureConverter
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
"""Test the Home Assistant SkyConnect hardware platform."""
|
||||
|
||||
from homeassistant.components.homeassistant_sky_connect.const import DOMAIN
|
||||
from homeassistant.core import EVENT_HOMEASSISTANT_STARTED, HomeAssistant
|
||||
from homeassistant.const import EVENT_HOMEASSISTANT_STARTED
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
|
|
|
@ -59,7 +59,8 @@ from homeassistant.const import (
|
|||
STATE_ON,
|
||||
EntityCategory,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant, HomeAssistantError, State
|
||||
from homeassistant.core import HomeAssistant, State
|
||||
from homeassistant.exceptions import HomeAssistantError
|
||||
from homeassistant.helpers import (
|
||||
device_registry as dr,
|
||||
entity_registry as er,
|
||||
|
|
|
@ -9,7 +9,8 @@ import pytest
|
|||
|
||||
from homeassistant.components.http import StaticPathConfig
|
||||
from homeassistant.components.http.static import CachingStaticResource, _get_file_path
|
||||
from homeassistant.core import EVENT_HOMEASSISTANT_START, HomeAssistant
|
||||
from homeassistant.const import EVENT_HOMEASSISTANT_START
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.http import KEY_ALLOW_CONFIGURED_CORS
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
|
|
|
@ -3,11 +3,11 @@
|
|||
from unittest.mock import patch
|
||||
|
||||
from homeassistant import config as hass_config
|
||||
from homeassistant.bootstrap import async_setup_component
|
||||
from homeassistant.components.intent_script import DOMAIN
|
||||
from homeassistant.const import SERVICE_RELOAD
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import intent
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from tests.common import async_mock_service, get_fixture_path
|
||||
|
||||
|
|
|
@ -8,11 +8,11 @@ from typing import Any
|
|||
from aiohttp.test_utils import TestClient
|
||||
import pytest
|
||||
|
||||
from homeassistant.bootstrap import async_setup_component
|
||||
from homeassistant.components import mailbox
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import issue_registry as ir
|
||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||
from homeassistant.setup import async_setup_component
|
||||
from homeassistant.util import dt as dt_util
|
||||
|
||||
from tests.common import MockModule, mock_integration, mock_platform
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
from datetime import timedelta
|
||||
|
||||
from freezegun import freeze_time
|
||||
|
||||
from homeassistant.components.sensor import SensorDeviceClass, SensorStateClass
|
||||
|
@ -51,7 +53,7 @@ async def test_minutes_remaining_sensor(hass: HomeAssistant) -> None:
|
|||
entry = mock_config_entry(hass)
|
||||
device = mock_melnor_device()
|
||||
|
||||
end_time = now + dt_util.dt.timedelta(minutes=10)
|
||||
end_time = now + timedelta(minutes=10)
|
||||
|
||||
# we control this mock
|
||||
|
||||
|
@ -76,7 +78,7 @@ async def test_minutes_remaining_sensor(hass: HomeAssistant) -> None:
|
|||
# Turn valve on
|
||||
device.zone1._is_watering = True
|
||||
|
||||
async_fire_time_changed(hass, now + dt_util.dt.timedelta(seconds=10))
|
||||
async_fire_time_changed(hass, now + timedelta(seconds=10))
|
||||
await hass.async_block_till_done()
|
||||
|
||||
# Valve is on, report 10
|
||||
|
@ -94,7 +96,7 @@ async def test_schedule_next_cycle_sensor(hass: HomeAssistant) -> None:
|
|||
entry = mock_config_entry(hass)
|
||||
device = mock_melnor_device()
|
||||
|
||||
next_cycle = now + dt_util.dt.timedelta(minutes=10)
|
||||
next_cycle = now + timedelta(minutes=10)
|
||||
|
||||
# we control this mock
|
||||
device.zone1.frequency._next_run_time = next_cycle
|
||||
|
@ -118,7 +120,7 @@ async def test_schedule_next_cycle_sensor(hass: HomeAssistant) -> None:
|
|||
# Turn valve on
|
||||
device.zone1._schedule_enabled = True
|
||||
|
||||
async_fire_time_changed(hass, now + dt_util.dt.timedelta(seconds=10))
|
||||
async_fire_time_changed(hass, now + timedelta(seconds=10))
|
||||
await hass.async_block_till_done()
|
||||
|
||||
# Valve is on, report 10
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
from datetime import time
|
||||
from datetime import time, timedelta
|
||||
|
||||
from homeassistant.core import HomeAssistant
|
||||
import homeassistant.util.dt as dt_util
|
||||
|
@ -46,7 +46,7 @@ async def test_schedule_start_time(hass: HomeAssistant) -> None:
|
|||
blocking=True,
|
||||
)
|
||||
|
||||
async_fire_time_changed(hass, now + dt_util.dt.timedelta(seconds=10))
|
||||
async_fire_time_changed(hass, now + timedelta(seconds=10))
|
||||
await hass.async_block_till_done()
|
||||
|
||||
time_entity = hass.states.get("time.zone_1_schedule_start_time")
|
||||
|
|
|
@ -9,7 +9,8 @@ from homeassistant.components.update import (
|
|||
SERVICE_INSTALL,
|
||||
)
|
||||
from homeassistant.const import ATTR_ENTITY_ID, STATE_OFF, STATE_ON
|
||||
from homeassistant.core import HomeAssistant, HomeAssistantError
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.exceptions import HomeAssistantError
|
||||
from homeassistant.util import dt as dt_util
|
||||
|
||||
from tests.common import MockConfigEntry, async_fire_time_changed
|
||||
|
|
|
@ -7,13 +7,8 @@ from homeassistant.components.recorder.filters import (
|
|||
extract_include_exclude_filter_conf,
|
||||
merge_include_exclude_filters,
|
||||
)
|
||||
from homeassistant.helpers.entityfilter import (
|
||||
CONF_DOMAINS,
|
||||
CONF_ENTITIES,
|
||||
CONF_ENTITY_GLOBS,
|
||||
CONF_EXCLUDE,
|
||||
CONF_INCLUDE,
|
||||
)
|
||||
from homeassistant.const import CONF_DOMAINS, CONF_ENTITIES, CONF_EXCLUDE, CONF_INCLUDE
|
||||
from homeassistant.helpers.entityfilter import CONF_ENTITY_GLOBS
|
||||
|
||||
EMPTY_INCLUDE_FILTER = {
|
||||
CONF_INCLUDE: {
|
||||
|
|
|
@ -13,14 +13,17 @@ from homeassistant.components.recorder.filters import (
|
|||
sqlalchemy_filter_from_include_exclude_conf,
|
||||
)
|
||||
from homeassistant.components.recorder.util import session_scope
|
||||
from homeassistant.const import ATTR_ENTITY_ID, STATE_ON
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.entityfilter import (
|
||||
from homeassistant.const import (
|
||||
ATTR_ENTITY_ID,
|
||||
CONF_DOMAINS,
|
||||
CONF_ENTITIES,
|
||||
CONF_ENTITY_GLOBS,
|
||||
CONF_EXCLUDE,
|
||||
CONF_INCLUDE,
|
||||
STATE_ON,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.entityfilter import (
|
||||
CONF_ENTITY_GLOBS,
|
||||
convert_include_exclude_filter,
|
||||
)
|
||||
|
||||
|
|
|
@ -16,14 +16,17 @@ from homeassistant.components.recorder.filters import (
|
|||
sqlalchemy_filter_from_include_exclude_conf,
|
||||
)
|
||||
from homeassistant.components.recorder.util import session_scope
|
||||
from homeassistant.const import ATTR_ENTITY_ID, STATE_ON
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.entityfilter import (
|
||||
from homeassistant.const import (
|
||||
ATTR_ENTITY_ID,
|
||||
CONF_DOMAINS,
|
||||
CONF_ENTITIES,
|
||||
CONF_ENTITY_GLOBS,
|
||||
CONF_EXCLUDE,
|
||||
CONF_INCLUDE,
|
||||
STATE_ON,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.entityfilter import (
|
||||
CONF_ENTITY_GLOBS,
|
||||
convert_include_exclude_filter,
|
||||
)
|
||||
|
||||
|
|
|
@ -13,7 +13,8 @@ from homeassistant.components import recorder
|
|||
from homeassistant.components.recorder import core, migration, statistics
|
||||
from homeassistant.components.recorder.queries import select_event_type_ids
|
||||
from homeassistant.components.recorder.util import session_scope
|
||||
from homeassistant.core import EVENT_STATE_CHANGED, Event, EventOrigin, State
|
||||
from homeassistant.const import EVENT_STATE_CHANGED
|
||||
from homeassistant.core import Event, EventOrigin, State
|
||||
import homeassistant.util.dt as dt_util
|
||||
|
||||
from .common import async_wait_recording_done
|
||||
|
|
|
@ -5,7 +5,6 @@ from unittest.mock import Mock
|
|||
import pytest
|
||||
from voluptuous.error import MultipleInvalid
|
||||
|
||||
from homeassistant.bootstrap import async_setup_component
|
||||
from homeassistant.components.rflink import (
|
||||
CONF_KEEPALIVE_IDLE,
|
||||
CONF_RECONNECT_INTERVAL,
|
||||
|
@ -28,6 +27,7 @@ from homeassistant.const import (
|
|||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.exceptions import HomeAssistantError
|
||||
from homeassistant.helpers import entity_registry as er
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
|
||||
async def mock_rflink(
|
||||
|
|
|
@ -31,11 +31,12 @@ from homeassistant.const import (
|
|||
CONF_ICON,
|
||||
CONF_ID,
|
||||
CONF_NAME,
|
||||
EVENT_STATE_CHANGED,
|
||||
SERVICE_RELOAD,
|
||||
STATE_OFF,
|
||||
STATE_ON,
|
||||
)
|
||||
from homeassistant.core import EVENT_STATE_CHANGED, Context, HomeAssistant
|
||||
from homeassistant.core import Context, HomeAssistant
|
||||
from homeassistant.helpers import entity_registry as er
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
|
|
|
@ -29,8 +29,8 @@ from homeassistant.core import (
|
|||
callback,
|
||||
split_entity_id,
|
||||
)
|
||||
from homeassistant.exceptions import ServiceNotFound
|
||||
from homeassistant.helpers import device_registry as dr, entity_registry as er, template
|
||||
from homeassistant.exceptions import ServiceNotFound, TemplateError
|
||||
from homeassistant.helpers import device_registry as dr, entity_registry as er
|
||||
from homeassistant.helpers.event import async_track_state_change
|
||||
from homeassistant.helpers.script import (
|
||||
SCRIPT_MODE_CHOICES,
|
||||
|
@ -1197,7 +1197,7 @@ async def test_script_variables(
|
|||
assert mock_calls[2].data["value"] == "from_service"
|
||||
|
||||
assert "Error rendering variables" not in caplog.text
|
||||
with pytest.raises(template.TemplateError):
|
||||
with pytest.raises(TemplateError):
|
||||
await hass.services.async_call("script", "script3", blocking=True)
|
||||
assert "Error rendering variables" in caplog.text
|
||||
assert len(mock_calls) == 3
|
||||
|
|
|
@ -6,10 +6,10 @@ import logging
|
|||
import pytest
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.bootstrap import async_setup_component
|
||||
from homeassistant.components import snips
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.intent import ServiceIntentHandler, async_register
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from tests.common import async_fire_mqtt_message, async_mock_intent, async_mock_service
|
||||
from tests.typing import MqttMockHAClient
|
||||
|
|
|
@ -5,10 +5,10 @@ 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
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
|
||||
async def test_valid_device_config(hass: HomeAssistant) -> None:
|
||||
|
|
|
@ -2,11 +2,11 @@
|
|||
|
||||
from http import HTTPStatus
|
||||
|
||||
from homeassistant.bootstrap import async_setup_component
|
||||
from homeassistant.components.startca.sensor import StartcaData
|
||||
from homeassistant.const import ATTR_UNIT_OF_MEASUREMENT, PERCENTAGE, UnitOfInformation
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from tests.test_util.aiohttp import AiohttpClientMocker
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ from pathlib import Path
|
|||
import tempfile
|
||||
from unittest.mock import AsyncMock, MagicMock, patch
|
||||
|
||||
from aiohttp import web
|
||||
import pytest
|
||||
from synology_dsm.api.photos import SynoPhotosAlbum, SynoPhotosItem
|
||||
from synology_dsm.exceptions import SynologyDSMException
|
||||
|
@ -30,7 +31,7 @@ from homeassistant.const import (
|
|||
CONF_USERNAME,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.util.aiohttp import MockRequest, web
|
||||
from homeassistant.util.aiohttp import MockRequest
|
||||
|
||||
from .consts import HOST, MACS, PASSWORD, PORT, USE_SSL, USERNAME
|
||||
|
||||
|
|
|
@ -10,10 +10,10 @@ import traceback
|
|||
from typing import Any
|
||||
from unittest.mock import MagicMock, patch
|
||||
|
||||
from homeassistant.bootstrap import async_setup_component
|
||||
from homeassistant.components import system_log
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from tests.common import async_capture_events
|
||||
from tests.typing import WebSocketGenerator
|
||||
|
|
|
@ -7,9 +7,9 @@ import pytest
|
|||
|
||||
from homeassistant import config
|
||||
from homeassistant.components.template import DOMAIN
|
||||
from homeassistant.const import SERVICE_RELOAD
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import device_registry as dr
|
||||
from homeassistant.helpers.reload import SERVICE_RELOAD
|
||||
from homeassistant.setup import async_setup_component
|
||||
from homeassistant.util import dt as dt_util
|
||||
|
||||
|
|
|
@ -9,11 +9,11 @@ from unittest.mock import patch
|
|||
import pytest
|
||||
from pytest_unordered import unordered
|
||||
|
||||
from homeassistant.bootstrap import async_setup_component
|
||||
from homeassistant.components.trace.const import DEFAULT_STORED_TRACES
|
||||
from homeassistant.const import EVENT_HOMEASSISTANT_STOP
|
||||
from homeassistant.core import Context, CoreState, HomeAssistant, callback
|
||||
from homeassistant.helpers.typing import UNDEFINED
|
||||
from homeassistant.setup import async_setup_component
|
||||
from homeassistant.util.uuid import random_uuid_hex
|
||||
|
||||
from tests.common import load_fixture
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
"""Test cases for the API stream sensor."""
|
||||
|
||||
from homeassistant.auth.providers.homeassistant import HassAuthProvider
|
||||
from homeassistant.bootstrap import async_setup_component
|
||||
from homeassistant.components.websocket_api.auth import TYPE_AUTH_REQUIRED
|
||||
from homeassistant.components.websocket_api.http import URL
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from .test_auth import test_auth_active_with_token
|
||||
|
||||
|
|
|
@ -37,6 +37,7 @@ import requests_mock
|
|||
from syrupy.assertion import SnapshotAssertion
|
||||
|
||||
from homeassistant import block_async_io
|
||||
from homeassistant.exceptions import ServiceNotFound
|
||||
|
||||
# Setup patching if dt_util time functions before any other Home Assistant imports
|
||||
from . import patch_time # noqa: F401, isort:skip
|
||||
|
@ -54,7 +55,7 @@ from homeassistant.components.websocket_api.auth import (
|
|||
from homeassistant.components.websocket_api.http import URL
|
||||
from homeassistant.config import YAML_CONFIG_FILE
|
||||
from homeassistant.config_entries import ConfigEntries, ConfigEntry, ConfigEntryState
|
||||
from homeassistant.const import HASSIO_USER_NAME
|
||||
from homeassistant.const import BASE_PLATFORMS, HASSIO_USER_NAME
|
||||
from homeassistant.core import (
|
||||
Context,
|
||||
CoreState,
|
||||
|
@ -77,7 +78,7 @@ from homeassistant.helpers import (
|
|||
from homeassistant.helpers.dispatcher import async_dispatcher_send
|
||||
from homeassistant.helpers.translation import _TranslationsCacheData
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
from homeassistant.setup import BASE_PLATFORMS, async_setup_component
|
||||
from homeassistant.setup import async_setup_component
|
||||
from homeassistant.util import dt as dt_util, location
|
||||
from homeassistant.util.async_ import create_eager_task
|
||||
from homeassistant.util.json import json_loads
|
||||
|
@ -1767,7 +1768,7 @@ def service_calls(hass: HomeAssistant) -> Generator[list[ServiceCall]]:
|
|||
target,
|
||||
return_response,
|
||||
)
|
||||
except ha.ServiceNotFound:
|
||||
except ServiceNotFound:
|
||||
_LOGGER.debug("Ignoring unknown service call to %s.%s", domain, service)
|
||||
return None
|
||||
|
||||
|
|
|
@ -16,9 +16,10 @@ from homeassistant.const import (
|
|||
CONF_PASSWORD,
|
||||
CONF_USERNAME,
|
||||
CONF_VERIFY_SSL,
|
||||
EVENT_HOMEASSISTANT_CLOSE,
|
||||
HTTP_BASIC_AUTHENTICATION,
|
||||
)
|
||||
from homeassistant.core import EVENT_HOMEASSISTANT_CLOSE, HomeAssistant
|
||||
from homeassistant.core import HomeAssistant
|
||||
import homeassistant.helpers.aiohttp_client as client
|
||||
from homeassistant.util.color import RGBColor
|
||||
|
||||
|
|
|
@ -6,7 +6,8 @@ from unittest.mock import AsyncMock, call, patch
|
|||
import pytest
|
||||
|
||||
from homeassistant import config_entries
|
||||
from homeassistant.core import EVENT_HOMEASSISTANT_STARTED, CoreState, HomeAssistant
|
||||
from homeassistant.const import EVENT_HOMEASSISTANT_STARTED
|
||||
from homeassistant.core import CoreState, HomeAssistant
|
||||
from homeassistant.helpers import discovery_flow
|
||||
|
||||
|
||||
|
|
|
@ -22,15 +22,16 @@ from homeassistant.const import (
|
|||
ATTR_FRIENDLY_NAME,
|
||||
STATE_UNAVAILABLE,
|
||||
STATE_UNKNOWN,
|
||||
EntityCategory,
|
||||
)
|
||||
from homeassistant.core import (
|
||||
Context,
|
||||
HassJobType,
|
||||
HomeAssistant,
|
||||
HomeAssistantError,
|
||||
ReleaseChannel,
|
||||
callback,
|
||||
)
|
||||
from homeassistant.exceptions import HomeAssistantError
|
||||
from homeassistant.helpers import device_registry as dr, entity, entity_registry as er
|
||||
from homeassistant.helpers.entity_component import async_update_entity
|
||||
from homeassistant.helpers.typing import UNDEFINED, UndefinedType
|
||||
|
@ -922,13 +923,13 @@ async def test_entity_category_property(hass: HomeAssistant) -> None:
|
|||
key="abc", entity_category="ignore_me"
|
||||
)
|
||||
mock_entity1.entity_id = "hello.world"
|
||||
mock_entity1._attr_entity_category = entity.EntityCategory.CONFIG
|
||||
mock_entity1._attr_entity_category = EntityCategory.CONFIG
|
||||
assert mock_entity1.entity_category == "config"
|
||||
|
||||
mock_entity2 = entity.Entity()
|
||||
mock_entity2.hass = hass
|
||||
mock_entity2.entity_description = entity.EntityDescription(
|
||||
key="abc", entity_category=entity.EntityCategory.CONFIG
|
||||
key="abc", entity_category=EntityCategory.CONFIG
|
||||
)
|
||||
mock_entity2.entity_id = "hello.world"
|
||||
assert mock_entity2.entity_category == "config"
|
||||
|
@ -937,8 +938,8 @@ async def test_entity_category_property(hass: HomeAssistant) -> None:
|
|||
@pytest.mark.parametrize(
|
||||
("value", "expected"),
|
||||
[
|
||||
("config", entity.EntityCategory.CONFIG),
|
||||
("diagnostic", entity.EntityCategory.DIAGNOSTIC),
|
||||
("config", EntityCategory.CONFIG),
|
||||
("diagnostic", EntityCategory.DIAGNOSTIC),
|
||||
],
|
||||
)
|
||||
def test_entity_category_schema(value, expected) -> None:
|
||||
|
@ -946,7 +947,7 @@ def test_entity_category_schema(value, expected) -> None:
|
|||
schema = vol.Schema(entity.ENTITY_CATEGORIES_SCHEMA)
|
||||
result = schema(value)
|
||||
assert result == expected
|
||||
assert isinstance(result, entity.EntityCategory)
|
||||
assert isinstance(result, EntityCategory)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("value", [None, "non_existing"])
|
||||
|
|
|
@ -9,7 +9,7 @@ from unittest.mock import ANY, AsyncMock, Mock, patch
|
|||
|
||||
import pytest
|
||||
|
||||
from homeassistant.const import EVENT_HOMEASSISTANT_STARTED, PERCENTAGE
|
||||
from homeassistant.const import EVENT_HOMEASSISTANT_STARTED, PERCENTAGE, EntityCategory
|
||||
from homeassistant.core import (
|
||||
CoreState,
|
||||
HomeAssistant,
|
||||
|
@ -26,12 +26,8 @@ from homeassistant.helpers import (
|
|||
entity_registry as er,
|
||||
issue_registry as ir,
|
||||
)
|
||||
from homeassistant.helpers.entity import (
|
||||
DeviceInfo,
|
||||
Entity,
|
||||
EntityCategory,
|
||||
async_generate_entity_id,
|
||||
)
|
||||
from homeassistant.helpers.device_registry import DeviceInfo
|
||||
from homeassistant.helpers.entity import Entity, async_generate_entity_id
|
||||
from homeassistant.helpers.entity_component import (
|
||||
DEFAULT_SCAN_INTERVAL,
|
||||
EntityComponent,
|
||||
|
|
|
@ -5,7 +5,8 @@ from unittest.mock import Mock, patch
|
|||
import httpx
|
||||
import pytest
|
||||
|
||||
from homeassistant.core import EVENT_HOMEASSISTANT_CLOSE, HomeAssistant
|
||||
from homeassistant.const import EVENT_HOMEASSISTANT_CLOSE
|
||||
from homeassistant.core import HomeAssistant
|
||||
import homeassistant.helpers.httpx_client as client
|
||||
|
||||
from tests.common import MockModule, extract_stack_to_frame, mock_integration
|
||||
|
|
|
@ -7,12 +7,13 @@ from unittest.mock import Mock, patch
|
|||
import pytest
|
||||
|
||||
from homeassistant import loader
|
||||
from homeassistant.const import EVENT_COMPONENT_LOADED
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.exceptions import HomeAssistantError
|
||||
from homeassistant.helpers.integration_platform import (
|
||||
async_process_integration_platforms,
|
||||
)
|
||||
from homeassistant.setup import ATTR_COMPONENT, EVENT_COMPONENT_LOADED
|
||||
from homeassistant.setup import ATTR_COMPONENT
|
||||
|
||||
from tests.common import mock_platform
|
||||
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
import pytest
|
||||
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import config_validation as cv, template
|
||||
from homeassistant.exceptions import TemplateError
|
||||
from homeassistant.helpers import config_validation as cv
|
||||
|
||||
|
||||
async def test_static_vars() -> None:
|
||||
|
@ -110,5 +111,5 @@ async def test_template_vars_run_args_no_default(hass: HomeAssistant) -> None:
|
|||
async def test_template_vars_error(hass: HomeAssistant) -> None:
|
||||
"""Test template vars."""
|
||||
var = cv.SCRIPT_VARIABLES_SCHEMA({"hello": "{{ canont.work }}"})
|
||||
with pytest.raises(template.TemplateError):
|
||||
with pytest.raises(TemplateError):
|
||||
var.async_render(hass, None)
|
||||
|
|
|
@ -15,14 +15,17 @@ import pytest
|
|||
from homeassistant import bootstrap, loader, runner
|
||||
import homeassistant.config as config_util
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import CONF_DEBUG, SIGNAL_BOOTSTRAP_INTEGRATIONS
|
||||
from homeassistant.const import (
|
||||
BASE_PLATFORMS,
|
||||
CONF_DEBUG,
|
||||
SIGNAL_BOOTSTRAP_INTEGRATIONS,
|
||||
)
|
||||
from homeassistant.core import CoreState, HomeAssistant, async_get_hass, callback
|
||||
from homeassistant.exceptions import HomeAssistantError
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
from homeassistant.helpers.translation import async_translations_loaded
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
from homeassistant.loader import Integration
|
||||
from homeassistant.setup import BASE_PLATFORMS
|
||||
|
||||
from .common import (
|
||||
MockConfigEntry,
|
||||
|
|
|
@ -29,15 +29,11 @@ from homeassistant.const import (
|
|||
CONF_LATITUDE,
|
||||
CONF_LONGITUDE,
|
||||
CONF_NAME,
|
||||
CONF_PACKAGES,
|
||||
__version__,
|
||||
)
|
||||
from homeassistant.core import (
|
||||
DOMAIN as HA_DOMAIN,
|
||||
ConfigSource,
|
||||
HomeAssistant,
|
||||
HomeAssistantError,
|
||||
)
|
||||
from homeassistant.exceptions import ConfigValidationError
|
||||
from homeassistant.core import DOMAIN as HA_DOMAIN, ConfigSource, HomeAssistant
|
||||
from homeassistant.exceptions import ConfigValidationError, HomeAssistantError
|
||||
from homeassistant.helpers import (
|
||||
check_config,
|
||||
config_validation as cv,
|
||||
|
@ -1070,11 +1066,7 @@ async def test_check_ha_config_file_wrong(mock_check, hass: HomeAssistant) -> No
|
|||
"hass_config",
|
||||
[
|
||||
{
|
||||
HA_DOMAIN: {
|
||||
config_util.CONF_PACKAGES: {
|
||||
"pack_dict": {"input_boolean": {"ib1": None}}
|
||||
}
|
||||
},
|
||||
HA_DOMAIN: {CONF_PACKAGES: {"pack_dict": {"input_boolean": {"ib1": None}}}},
|
||||
"input_boolean": {"ib2": None},
|
||||
"light": {"platform": "test"},
|
||||
}
|
||||
|
@ -1088,7 +1080,7 @@ async def test_async_hass_config_yaml_merge(
|
|||
conf = await config_util.async_hass_config_yaml(hass)
|
||||
|
||||
assert merge_log_err.call_count == 0
|
||||
assert conf[HA_DOMAIN].get(config_util.CONF_PACKAGES) is not None
|
||||
assert conf[HA_DOMAIN].get(CONF_PACKAGES) is not None
|
||||
assert len(conf) == 3
|
||||
assert len(conf["input_boolean"]) == 2
|
||||
assert len(conf["light"]) == 1
|
||||
|
@ -1116,7 +1108,7 @@ async def test_merge(merge_log_err: MagicMock, hass: HomeAssistant) -> None:
|
|||
},
|
||||
}
|
||||
config = {
|
||||
HA_DOMAIN: {config_util.CONF_PACKAGES: packages},
|
||||
HA_DOMAIN: {CONF_PACKAGES: packages},
|
||||
"input_boolean": {"ib2": None},
|
||||
"light": {"platform": "test"},
|
||||
"automation": [],
|
||||
|
@ -1143,7 +1135,7 @@ async def test_merge_try_falsy(merge_log_err: MagicMock, hass: HomeAssistant) ->
|
|||
"pack_list2": {"light": OrderedDict()},
|
||||
}
|
||||
config = {
|
||||
HA_DOMAIN: {config_util.CONF_PACKAGES: packages},
|
||||
HA_DOMAIN: {CONF_PACKAGES: packages},
|
||||
"automation": {"do": "something"},
|
||||
"light": {"some": "light"},
|
||||
}
|
||||
|
@ -1166,7 +1158,7 @@ async def test_merge_new(merge_log_err: MagicMock, hass: HomeAssistant) -> None:
|
|||
"api": {},
|
||||
},
|
||||
}
|
||||
config = {HA_DOMAIN: {config_util.CONF_PACKAGES: packages}}
|
||||
config = {HA_DOMAIN: {CONF_PACKAGES: packages}}
|
||||
await config_util.merge_packages_config(hass, config, packages)
|
||||
|
||||
assert merge_log_err.call_count == 0
|
||||
|
@ -1186,7 +1178,7 @@ async def test_merge_type_mismatch(
|
|||
"pack_2": {"light": {"ib1": None}}, # light gets merged - ensure_list
|
||||
}
|
||||
config = {
|
||||
HA_DOMAIN: {config_util.CONF_PACKAGES: packages},
|
||||
HA_DOMAIN: {CONF_PACKAGES: packages},
|
||||
"input_boolean": {"ib2": None},
|
||||
"input_select": [{"ib2": None}],
|
||||
"light": [{"platform": "two"}],
|
||||
|
@ -1204,13 +1196,13 @@ async def test_merge_once_only_keys(
|
|||
) -> None:
|
||||
"""Test if we have a merge for a comp that may occur only once. Keys."""
|
||||
packages = {"pack_2": {"api": None}}
|
||||
config = {HA_DOMAIN: {config_util.CONF_PACKAGES: packages}, "api": None}
|
||||
config = {HA_DOMAIN: {CONF_PACKAGES: packages}, "api": None}
|
||||
await config_util.merge_packages_config(hass, config, packages)
|
||||
assert config["api"] == OrderedDict()
|
||||
|
||||
packages = {"pack_2": {"api": {"key_3": 3}}}
|
||||
config = {
|
||||
HA_DOMAIN: {config_util.CONF_PACKAGES: packages},
|
||||
HA_DOMAIN: {CONF_PACKAGES: packages},
|
||||
"api": {"key_1": 1, "key_2": 2},
|
||||
}
|
||||
await config_util.merge_packages_config(hass, config, packages)
|
||||
|
@ -1219,7 +1211,7 @@ async def test_merge_once_only_keys(
|
|||
# Duplicate keys error
|
||||
packages = {"pack_2": {"api": {"key": 2}}}
|
||||
config = {
|
||||
HA_DOMAIN: {config_util.CONF_PACKAGES: packages},
|
||||
HA_DOMAIN: {CONF_PACKAGES: packages},
|
||||
"api": {"key": 1},
|
||||
}
|
||||
await config_util.merge_packages_config(hass, config, packages)
|
||||
|
@ -1234,7 +1226,7 @@ async def test_merge_once_only_lists(hass: HomeAssistant) -> None:
|
|||
}
|
||||
}
|
||||
config = {
|
||||
HA_DOMAIN: {config_util.CONF_PACKAGES: packages},
|
||||
HA_DOMAIN: {CONF_PACKAGES: packages},
|
||||
"api": {"list_1": ["item_1"]},
|
||||
}
|
||||
await config_util.merge_packages_config(hass, config, packages)
|
||||
|
@ -1257,7 +1249,7 @@ async def test_merge_once_only_dictionaries(hass: HomeAssistant) -> None:
|
|||
}
|
||||
}
|
||||
config = {
|
||||
HA_DOMAIN: {config_util.CONF_PACKAGES: packages},
|
||||
HA_DOMAIN: {CONF_PACKAGES: packages},
|
||||
"api": {"dict_1": {"key_1": 1, "dict_1.1": {"key_1.1": 1.1}}},
|
||||
}
|
||||
await config_util.merge_packages_config(hass, config, packages)
|
||||
|
@ -1293,7 +1285,7 @@ async def test_merge_duplicate_keys(
|
|||
"""Test if keys in dicts are duplicates."""
|
||||
packages = {"pack_1": {"input_select": {"ib1": None}}}
|
||||
config = {
|
||||
HA_DOMAIN: {config_util.CONF_PACKAGES: packages},
|
||||
HA_DOMAIN: {CONF_PACKAGES: packages},
|
||||
"input_select": {"ib1": 1},
|
||||
}
|
||||
await config_util.merge_packages_config(hass, config, packages)
|
||||
|
@ -1451,7 +1443,7 @@ async def test_merge_split_component_definition(hass: HomeAssistant) -> None:
|
|||
"pack_1": {"light one": {"l1": None}},
|
||||
"pack_2": {"light two": {"l2": None}, "light three": {"l3": None}},
|
||||
}
|
||||
config = {HA_DOMAIN: {config_util.CONF_PACKAGES: packages}}
|
||||
config = {HA_DOMAIN: {CONF_PACKAGES: packages}}
|
||||
await config_util.merge_packages_config(hass, config, packages)
|
||||
|
||||
assert len(config) == 4
|
||||
|
@ -2340,7 +2332,7 @@ async def test_packages_schema_validation_error(
|
|||
]
|
||||
assert error_records == snapshot
|
||||
|
||||
assert len(config[HA_DOMAIN][config_util.CONF_PACKAGES]) == 0
|
||||
assert len(config[HA_DOMAIN][CONF_PACKAGES]) == 0
|
||||
|
||||
|
||||
def test_extract_domain_configs() -> None:
|
||||
|
|
|
@ -1629,7 +1629,7 @@ async def test_serviceregistry_call_non_existing_with_blocking(
|
|||
hass: HomeAssistant,
|
||||
) -> None:
|
||||
"""Test non-existing with blocking."""
|
||||
with pytest.raises(ha.ServiceNotFound):
|
||||
with pytest.raises(ServiceNotFound):
|
||||
await hass.services.async_call("test_domain", "i_do_not_exist", blocking=True)
|
||||
|
||||
|
||||
|
@ -2529,14 +2529,14 @@ async def test_reserving_states(hass: HomeAssistant) -> None:
|
|||
hass.states.async_set("light.bedroom", "on")
|
||||
assert hass.states.async_available("light.bedroom") is False
|
||||
|
||||
with pytest.raises(ha.HomeAssistantError):
|
||||
with pytest.raises(HomeAssistantError):
|
||||
hass.states.async_reserve("light.bedroom")
|
||||
|
||||
hass.states.async_remove("light.bedroom")
|
||||
assert hass.states.async_available("light.bedroom") is True
|
||||
hass.states.async_set("light.bedroom", "on")
|
||||
|
||||
with pytest.raises(ha.HomeAssistantError):
|
||||
with pytest.raises(HomeAssistantError):
|
||||
hass.states.async_reserve("light.bedroom")
|
||||
|
||||
assert hass.states.async_available("light.bedroom") is False
|
||||
|
@ -2840,7 +2840,7 @@ async def test_state_change_events_context_id_match_state_time(
|
|||
hass: HomeAssistant,
|
||||
) -> None:
|
||||
"""Test last_updated, timed_fired, and the ulid all have the same time."""
|
||||
events = async_capture_events(hass, ha.EVENT_STATE_CHANGED)
|
||||
events = async_capture_events(hass, EVENT_STATE_CHANGED)
|
||||
hass.states.async_set("light.bedroom", "on")
|
||||
await hass.async_block_till_done()
|
||||
state: State = hass.states.get("light.bedroom")
|
||||
|
@ -2859,7 +2859,7 @@ async def test_state_change_events_match_time_with_limits_of_precision(
|
|||
a bit better than the precision of datetime.now() which is used for last_updated
|
||||
on some platforms.
|
||||
"""
|
||||
events = async_capture_events(hass, ha.EVENT_STATE_CHANGED)
|
||||
events = async_capture_events(hass, EVENT_STATE_CHANGED)
|
||||
hass.states.async_set("light.bedroom", "on")
|
||||
await hass.async_block_till_done()
|
||||
state: State = hass.states.get("light.bedroom")
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
import asyncio
|
||||
from collections.abc import Iterator
|
||||
import subprocess
|
||||
import threading
|
||||
from unittest.mock import patch
|
||||
|
||||
|
@ -169,21 +170,21 @@ def test_enable_posix_spawn() -> None:
|
|||
yield from packaging.tags.parse_tag("cp311-cp311-musllinux_1_1_x86_64")
|
||||
|
||||
with (
|
||||
patch.object(runner.subprocess, "_USE_POSIX_SPAWN", False),
|
||||
patch.object(subprocess, "_USE_POSIX_SPAWN", False),
|
||||
patch(
|
||||
"homeassistant.runner.packaging.tags.sys_tags",
|
||||
side_effect=_mock_sys_tags_musl,
|
||||
),
|
||||
):
|
||||
runner._enable_posix_spawn()
|
||||
assert runner.subprocess._USE_POSIX_SPAWN is True
|
||||
assert subprocess._USE_POSIX_SPAWN is True
|
||||
|
||||
with (
|
||||
patch.object(runner.subprocess, "_USE_POSIX_SPAWN", False),
|
||||
patch.object(subprocess, "_USE_POSIX_SPAWN", False),
|
||||
patch(
|
||||
"homeassistant.runner.packaging.tags.sys_tags",
|
||||
side_effect=_mock_sys_tags_any,
|
||||
),
|
||||
):
|
||||
runner._enable_posix_spawn()
|
||||
assert runner.subprocess._USE_POSIX_SPAWN is False
|
||||
assert subprocess._USE_POSIX_SPAWN is False
|
||||
|
|
|
@ -566,8 +566,8 @@ def test_no_recursive_secrets() -> None:
|
|||
|
||||
def test_input_class() -> None:
|
||||
"""Test input class."""
|
||||
yaml_input = yaml_loader.Input("hello")
|
||||
yaml_input2 = yaml_loader.Input("hello")
|
||||
yaml_input = yaml.Input("hello")
|
||||
yaml_input2 = yaml.Input("hello")
|
||||
|
||||
assert yaml_input.name == "hello"
|
||||
assert yaml_input == yaml_input2
|
||||
|
|
Loading…
Reference in New Issue