From 739963b5ee1a49039eb19a1831bb569dab255fcc Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sun, 23 Apr 2023 22:38:35 -0500 Subject: [PATCH] Remove deprecated async_setup_platforms (#91929) --- .../components/brottsplatskartan/__init__.py | 2 +- homeassistant/components/workday/__init__.py | 2 +- homeassistant/config_entries.py | 20 ------------------- tests/test_config_entries.py | 2 +- 4 files changed, 3 insertions(+), 23 deletions(-) diff --git a/homeassistant/components/brottsplatskartan/__init__.py b/homeassistant/components/brottsplatskartan/__init__.py index 4d570425f67..14e6e383e85 100644 --- a/homeassistant/components/brottsplatskartan/__init__.py +++ b/homeassistant/components/brottsplatskartan/__init__.py @@ -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 diff --git a/homeassistant/components/workday/__init__.py b/homeassistant/components/workday/__init__.py index 0ddd7a896ac..d1ad8456bab 100644 --- a/homeassistant/components/workday/__init__.py +++ b/homeassistant/components/workday/__init__.py @@ -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 diff --git a/homeassistant/config_entries.py b/homeassistant/config_entries.py index 34872d8cec1..574fdda0252 100644 --- a/homeassistant/config_entries.py +++ b/homeassistant/config_entries.py @@ -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: diff --git a/tests/test_config_entries.py b/tests/test_config_entries.py index 6a9258d4ede..ccfc60d7d97 100644 --- a/tests/test_config_entries.py +++ b/tests/test_config_entries.py @@ -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(