mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 12:59:34 +00:00
Catch all exceptions on import component/platform (#64930)
This commit is contained in:
@@ -157,6 +157,21 @@ async def test_get_integration(hass):
|
||||
assert hue_light == integration.get_platform("light")
|
||||
|
||||
|
||||
async def test_get_integration_exceptions(hass):
|
||||
"""Test resolving integration."""
|
||||
integration = await loader.async_get_integration(hass, "hue")
|
||||
|
||||
with pytest.raises(ImportError), patch(
|
||||
"homeassistant.loader.importlib.import_module", side_effect=ValueError("Boom")
|
||||
):
|
||||
assert hue == integration.get_component()
|
||||
|
||||
with pytest.raises(ImportError), patch(
|
||||
"homeassistant.loader.importlib.import_module", side_effect=ValueError("Boom")
|
||||
):
|
||||
assert hue_light == integration.get_platform("light")
|
||||
|
||||
|
||||
async def test_get_integration_legacy(hass, enable_custom_integrations):
|
||||
"""Test resolving integration."""
|
||||
integration = await loader.async_get_integration(hass, "test_embedded")
|
||||
|
||||
Reference in New Issue
Block a user