Integration requirement check refactor (#25626)

* Factor out code getting requirements for integration

* Have process requirements raise an exception

* One more lint fix

* Blackify

* Catch new exception

* Let RequirementsNotFound be a HomeAssistantError

* Correct another test

* Split catching of exceptions and avoid complete log
This commit is contained in:
Joakim Plate authored and Paulus Schoutsen committed 2019-08-07 15:35:50 -07:00
1 parent c3455efc11
commit d1b9ebc7b2
9 files changed
+115 -121

No files matched your search

+1 -6
View File
@@ -164,14 +164,9 @@ async def _load_mfa_module(hass: HomeAssistant, module_name: str) -> types.Modul
processed = hass.data[DATA_REQS] = set()
# https://github.com/python/mypy/issues/1424
req_success = await requirements.async_process_requirements(
await requirements.async_process_requirements(
hass, module_path, module.REQUIREMENTS # type: ignore
)
if not req_success:
raise HomeAssistantError(
"Unable to process requirements of mfa module {}".format(module_name)
)
processed.add(module_name)
return module