Remove deprecated remote constants (#131809)

pull/131827/head^2
Robert Resch 2024-11-28 12:14:06 +01:00 committed by GitHub
parent 3866176e1d
commit c5f68bcc58
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 1 additions and 46 deletions

View File

@ -22,12 +22,6 @@ from homeassistant.const import (
)
from homeassistant.core import HomeAssistant
from homeassistant.helpers import config_validation as cv
from homeassistant.helpers.deprecation import (
DeprecatedConstantEnum,
all_with_deprecated_constants,
check_if_deprecated_constant,
dir_with_deprecated_constants,
)
from homeassistant.helpers.entity import ToggleEntity, ToggleEntityDescription
from homeassistant.helpers.entity_component import EntityComponent
from homeassistant.helpers.typing import ConfigType
@ -74,19 +68,6 @@ class RemoteEntityFeature(IntFlag):
ACTIVITY = 4
# These SUPPORT_* constants are deprecated as of Home Assistant 2022.5.
# Please use the RemoteEntityFeature enum instead.
_DEPRECATED_SUPPORT_LEARN_COMMAND = DeprecatedConstantEnum(
RemoteEntityFeature.LEARN_COMMAND, "2025.1"
)
_DEPRECATED_SUPPORT_DELETE_COMMAND = DeprecatedConstantEnum(
RemoteEntityFeature.DELETE_COMMAND, "2025.1"
)
_DEPRECATED_SUPPORT_ACTIVITY = DeprecatedConstantEnum(
RemoteEntityFeature.ACTIVITY, "2025.1"
)
REMOTE_SERVICE_ACTIVITY_SCHEMA = cv.make_entity_service_schema(
{vol.Optional(ATTR_ACTIVITY): cv.string}
)
@ -251,11 +232,3 @@ class RemoteEntity(ToggleEntity, cached_properties=CACHED_PROPERTIES_WITH_ATTR_)
await self.hass.async_add_executor_job(
ft.partial(self.delete_command, **kwargs)
)
# These can be removed if no deprecated constant are in this module anymore
__getattr__ = ft.partial(check_if_deprecated_constant, module_globals=globals())
__dir__ = ft.partial(
dir_with_deprecated_constants, module_globals_keys=[*globals().keys()]
)
__all__ = all_with_deprecated_constants(globals())

View File

@ -23,11 +23,7 @@ from homeassistant.const import (
)
from homeassistant.core import HomeAssistant
from tests.common import (
async_mock_service,
help_test_all,
import_and_test_deprecated_constant_enum,
)
from tests.common import async_mock_service
TEST_PLATFORM = {DOMAIN: {CONF_PLATFORM: "test"}}
SERVICE_SEND_COMMAND = "send_command"
@ -148,20 +144,6 @@ async def test_delete_command(hass: HomeAssistant) -> None:
assert call.data[ATTR_ENTITY_ID] == ENTITY_ID
def test_all() -> None:
"""Test module.__all__ is correctly set."""
help_test_all(remote)
@pytest.mark.parametrize(("enum"), list(remote.RemoteEntityFeature))
def test_deprecated_constants(
caplog: pytest.LogCaptureFixture,
enum: remote.RemoteEntityFeature,
) -> None:
"""Test deprecated constants."""
import_and_test_deprecated_constant_enum(caplog, remote, enum, "SUPPORT_", "2025.1")
def test_deprecated_supported_features_ints(caplog: pytest.LogCaptureFixture) -> None:
"""Test deprecated supported features ints."""