Check for import errors before validating config (#28395)

This commit is contained in:
Paulus Schoutsen 2019-10-31 11:38:06 -07:00 committed by GitHub
parent 674860e00e
commit 70c4b4a4f0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 6 deletions

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", {})