Avoid creating tasks for dependencies already being setup (#111034)

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
This commit is contained in:
J. Nick Koston
2024-02-22 12:34:46 -10:00
committed by GitHub
parent 32cd3ad862
commit 2ef71289b9
4 changed files with 71 additions and 25 deletions

View File

@ -319,6 +319,7 @@ async def test_component_failing_setup(hass: HomeAssistant) -> None:
async def test_component_exception_setup(hass: HomeAssistant) -> None:
"""Test component that raises exception during setup."""
setup.async_set_domains_to_be_loaded(hass, {"comp"})
def exception_setup(hass, config):
"""Raise exception."""
@ -330,6 +331,22 @@ async def test_component_exception_setup(hass: HomeAssistant) -> None:
assert "comp" not in hass.config.components
async def test_component_base_exception_setup(hass: HomeAssistant) -> None:
"""Test component that raises exception during setup."""
setup.async_set_domains_to_be_loaded(hass, {"comp"})
def exception_setup(hass, config):
"""Raise exception."""
raise BaseException("fail!")
mock_integration(hass, MockModule("comp", setup=exception_setup))
with pytest.raises(BaseException):
await setup.async_setup_component(hass, "comp", {})
assert "comp" not in hass.config.components
async def test_component_setup_with_validation_and_dependency(
hass: HomeAssistant,
) -> None: