Skip to content

Commit

Permalink
Remove deprecated async_setup_platforms (home-assistant#91929)
Browse files Browse the repository at this point in the history
  • Loading branch information
bdraco authored Apr 24, 2023
1 parent a203149 commit 739963b
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 23 deletions.
2 changes: 1 addition & 1 deletion homeassistant/components/brottsplatskartan/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
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

Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/workday/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
20 changes: 0 additions & 20 deletions homeassistant/config_entries.py
Original file line number Diff line number Diff line change
Expand Up @@ -1356,26 +1356,6 @@ def _async_dispatch(
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:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_config_entries.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ async def mock_setup_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(
Expand Down

0 comments on commit 739963b

Please sign in to comment.