Allow importing homeassistant.core.Config until 2025.11 (#129537)

pull/129970/head
Erik Montnemery 2024-10-30 22:56:59 +01:00 committed by Bram Kragten
parent fc602b1888
commit c49b155c29
2 changed files with 21 additions and 0 deletions

View File

@ -83,6 +83,7 @@ from .exceptions import (
Unauthorized,
)
from .helpers.deprecation import (
DeferredDeprecatedAlias,
DeprecatedConstantEnum,
EnumWithDeprecatedMembers,
all_with_deprecated_constants,
@ -184,6 +185,19 @@ _DEPRECATED_SOURCE_STORAGE = DeprecatedConstantEnum(ConfigSource.STORAGE, "2025.
_DEPRECATED_SOURCE_YAML = DeprecatedConstantEnum(ConfigSource.YAML, "2025.1")
def _deprecated_core_config() -> Any:
# pylint: disable-next=import-outside-toplevel
from . import core_config
return core_config.Config
# The Config class was moved to core_config in Home Assistant 2024.11
_DEPRECATED_Config = DeferredDeprecatedAlias(
_deprecated_core_config, "homeassistant.core_config.Config", "2025.11"
)
# How long to wait until things that run on startup have to finish.
TIMEOUT_EVENT_START = 15

View File

@ -48,6 +48,7 @@ from homeassistant.core import (
callback,
get_release_channel,
)
from homeassistant.core_config import Config
from homeassistant.exceptions import (
HomeAssistantError,
InvalidEntityFormatError,
@ -66,6 +67,7 @@ from .common import (
async_capture_events,
async_mock_service,
help_test_all,
import_and_test_deprecated_alias,
import_and_test_deprecated_constant_enum,
)
@ -2994,6 +2996,11 @@ def test_deprecated_constants(
import_and_test_deprecated_constant_enum(caplog, ha, enum, "SOURCE_", "2025.1")
def test_deprecated_config(caplog: pytest.LogCaptureFixture) -> None:
"""Test deprecated Config class."""
import_and_test_deprecated_alias(caplog, ha, "Config", Config, "2025.11")
def test_one_time_listener_repr(hass: HomeAssistant) -> None:
"""Test one time listener repr."""