Allow importing homeassistant.core.Config until 2025.11 (#129537)
parent
fc602b1888
commit
c49b155c29
|
@ -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
|
||||
|
||||
|
|
|
@ -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."""
|
||||
|
||||
|
|
Loading…
Reference in New Issue