From a16e298599b222b04f70484c89b28600069224d7 Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Fri, 17 Feb 2023 19:13:48 +0100 Subject: [PATCH] Adjust json imports in tests (#88248) --- tests/components/bluetooth/test_base_scanner.py | 2 +- tests/components/bluetooth/test_manager.py | 2 +- tests/components/homekit/test_iidmanager.py | 2 +- tests/components/recorder/db_schema_30.py | 8 ++------ tests/components/websocket_api/test_commands.py | 2 +- tests/conftest.py | 2 +- tests/test_util/aiohttp.py | 3 ++- 7 files changed, 9 insertions(+), 12 deletions(-) diff --git a/tests/components/bluetooth/test_base_scanner.py b/tests/components/bluetooth/test_base_scanner.py index 06eec4b5121..14722d81ae6 100644 --- a/tests/components/bluetooth/test_base_scanner.py +++ b/tests/components/bluetooth/test_base_scanner.py @@ -25,9 +25,9 @@ from homeassistant.components.bluetooth.const import ( UNAVAILABLE_TRACK_SECONDS, ) from homeassistant.core import HomeAssistant, callback -from homeassistant.helpers.json import json_loads from homeassistant.setup import async_setup_component import homeassistant.util.dt as dt_util +from homeassistant.util.json import json_loads from . import MockBleakClient, _get_manager, generate_advertisement_data diff --git a/tests/components/bluetooth/test_manager.py b/tests/components/bluetooth/test_manager.py index 5db2d80a7a6..64bfd2b9281 100644 --- a/tests/components/bluetooth/test_manager.py +++ b/tests/components/bluetooth/test_manager.py @@ -28,9 +28,9 @@ from homeassistant.components.bluetooth.manager import ( FALLBACK_MAXIMUM_STALE_ADVERTISEMENT_SECONDS, ) from homeassistant.core import HomeAssistant, callback -from homeassistant.helpers.json import json_loads from homeassistant.setup import async_setup_component from homeassistant.util import dt as dt_util +from homeassistant.util.json import json_loads from . import ( FakeScanner, diff --git a/tests/components/homekit/test_iidmanager.py b/tests/components/homekit/test_iidmanager.py index d27b3d7b165..386e8cf8f11 100644 --- a/tests/components/homekit/test_iidmanager.py +++ b/tests/components/homekit/test_iidmanager.py @@ -8,7 +8,7 @@ from homeassistant.components.homekit.iidmanager import ( get_iid_storage_filename_for_entry_id, ) from homeassistant.core import HomeAssistant -from homeassistant.helpers.json import json_loads +from homeassistant.util.json import json_loads from homeassistant.util.uuid import random_uuid_hex from tests.common import MockConfigEntry, load_fixture diff --git a/tests/components/recorder/db_schema_30.py b/tests/components/recorder/db_schema_30.py index 78715480297..e5408662e5f 100644 --- a/tests/components/recorder/db_schema_30.py +++ b/tests/components/recorder/db_schema_30.py @@ -46,13 +46,9 @@ from homeassistant.const import ( MAX_LENGTH_STATE_STATE, ) from homeassistant.core import Context, Event, EventOrigin, State, split_entity_id -from homeassistant.helpers.json import ( - JSON_DECODE_EXCEPTIONS, - JSON_DUMP, - json_bytes, - json_loads, -) +from homeassistant.helpers.json import JSON_DUMP, json_bytes import homeassistant.util.dt as dt_util +from homeassistant.util.json import JSON_DECODE_EXCEPTIONS, json_loads ALL_DOMAIN_EXCLUDE_ATTRS = {ATTR_ATTRIBUTION, ATTR_RESTORED, ATTR_SUPPORTED_FEATURES} diff --git a/tests/components/websocket_api/test_commands.py b/tests/components/websocket_api/test_commands.py index 7f5fdf85b65..dd1e583d2da 100644 --- a/tests/components/websocket_api/test_commands.py +++ b/tests/components/websocket_api/test_commands.py @@ -19,9 +19,9 @@ from homeassistant.core import Context, HomeAssistant, State, callback from homeassistant.exceptions import HomeAssistantError from homeassistant.helpers import entity from homeassistant.helpers.dispatcher import async_dispatcher_send -from homeassistant.helpers.json import json_loads from homeassistant.loader import async_get_integration from homeassistant.setup import DATA_SETUP_TIME, async_setup_component +from homeassistant.util.json import json_loads from tests.common import MockEntity, MockEntityPlatform, MockUser, async_mock_service from tests.typing import ClientSessionGenerator, WebSocketGenerator diff --git a/tests/conftest.py b/tests/conftest.py index 12ae9d3e814..7e58f1a6ffe 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -55,10 +55,10 @@ from homeassistant.helpers import ( issue_registry as ir, recorder as recorder_helper, ) -from homeassistant.helpers.json import json_loads from homeassistant.helpers.typing import ConfigType from homeassistant.setup import async_setup_component from homeassistant.util import dt as dt_util, location +from homeassistant.util.json import json_loads from .ignore_uncaught_exceptions import IGNORE_UNCAUGHT_EXCEPTIONS from .typing import ( diff --git a/tests/test_util/aiohttp.py b/tests/test_util/aiohttp.py index b8a6dc5ad96..356240dc37a 100644 --- a/tests/test_util/aiohttp.py +++ b/tests/test_util/aiohttp.py @@ -13,7 +13,8 @@ from multidict import CIMultiDict from yarl import URL from homeassistant.const import EVENT_HOMEASSISTANT_CLOSE -from homeassistant.helpers.json import json_dumps, json_loads +from homeassistant.helpers.json import json_dumps +from homeassistant.util.json import json_loads RETYPE = type(re.compile(""))