Remove deprecated async_setup_platforms (#91929)

pull/91940/head
J. Nick Koston 2023-04-23 22:38:35 -05:00 committed by GitHub
parent a203149133
commit 739963b5ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 3 additions and 23 deletions

View File

@ -10,7 +10,7 @@ from .const import PLATFORMS
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Set up brottsplatskartan from a config entry."""
hass.config_entries.async_setup_platforms(entry, PLATFORMS)
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
return True

View File

@ -12,7 +12,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
entry.async_on_unload(entry.add_update_listener(async_update_listener))
hass.config_entries.async_setup_platforms(entry, PLATFORMS)
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
return True

View File

@ -1356,26 +1356,6 @@ class ConfigEntries:
self.hass, SIGNAL_CONFIG_ENTRY_CHANGED, change_type, entry
)
@callback
def async_setup_platforms(
self, entry: ConfigEntry, platforms: Iterable[Platform | str]
) -> None:
"""Forward the setup of an entry to platforms."""
report(
(
"called async_setup_platforms instead of awaiting"
" async_forward_entry_setups; this will fail in version 2023.3"
),
# Raise this to warning once all core integrations have been migrated
level=logging.WARNING,
error_if_core=False,
)
for platform in platforms:
self.hass.async_create_task(
self.async_forward_entry_setup(entry, platform),
f"config entry forward setup {entry.title} {entry.domain} {entry.entry_id} {platform}",
)
async def async_forward_entry_setups(
self, entry: ConfigEntry, platforms: Iterable[Platform | str]
) -> None:

View File

@ -276,7 +276,7 @@ async def test_remove_entry(
hass: HomeAssistant, entry: config_entries.ConfigEntry
) -> bool:
"""Mock setting up entry."""
hass.config_entries.async_setup_platforms(entry, ["light"])
await hass.config_entries.async_forward_entry_setups(entry, ["light"])
return True
async def mock_unload_entry(