Migrate remaining calls in config modules to async_get_component (#112293)

* Migrate remaining calls in config modules to async_get_component

There were a few cases that were still using get_component that
could have done blocking I/O in the event loop, although it
was unlikely.

The caching check in async_get_component has been moved
up to avoid creating the future if the module is already in
the cache

* fix one more
This commit is contained in:
J. Nick Koston
2024-03-05 04:59:52 -10:00
committed by GitHub
parent 390f5822fe
commit 7cb8a8bbc9
5 changed files with 30 additions and 20 deletions

View File

@ -617,7 +617,7 @@ async def test_async_when_setup_or_start_already_loaded(hass: HomeAssistant) ->
async def test_setup_import_blows_up(hass: HomeAssistant) -> None:
"""Test that we handle it correctly when importing integration blows up."""
with patch(
"homeassistant.loader.Integration.get_component", side_effect=ImportError
"homeassistant.loader.Integration.async_get_component", side_effect=ImportError
):
assert not await setup.async_setup_component(hass, "sun", {})