Check for import errors before validating config (#28395)

This commit is contained in:
Paulus Schoutsen committed 2019-10-31 12:11:30 -07:00
1 parent d57fe0334f
commit 4e2a8fde86
2 files changed
+19 -6

No files matched your search

+8
View File
@@ -527,3 +527,11 @@ async def test_when_setup_already_loaded(hass):
setup.async_when_setup(hass, "test", mock_callback)
await hass.async_block_till_done()
assert calls == ["test", "test"]
async def test_setup_import_blows_up(hass):
"""Test that we handle it correctly when importing integration blows up."""
with mock.patch(
"homeassistant.loader.Integration.get_component", side_effect=ValueError
):
assert not await setup.async_setup_component(hass, "sun", {})