Don't swallow all errors when checking for config validator platform (#42058)

This commit is contained in:
Paulus Schoutsen authored and GitHub committed 2020-10-19 17:09:57 +02:00
1 parent 8d4675713a
commit 440570244d
6 files changed
+54 -13

No files matched your search

+5 -3
View File
@@ -419,11 +419,13 @@ class Integration:
cache = self.hass.data.setdefault(DATA_COMPONENTS, {})
full_name = f"{self.domain}.{platform_name}"
if full_name not in cache:
cache[full_name] = importlib.import_module(
f"{self.pkg_path}.{platform_name}"
)
cache[full_name] = self._import_platform(platform_name)
return cache[full_name] # type: ignore
def _import_platform(self, platform_name: str) -> ModuleType:
"""Import the platform."""
return importlib.import_module(f"{self.pkg_path}.{platform_name}")
def __repr__(self) -> str:
"""Text representation of class."""
return f"<Integration {self.domain}: {self.pkg_path}>"