Fix empty components (#23177)

This commit is contained in:
Paulus Schoutsen 2019-04-17 19:17:13 -07:00 committed by Jason Hu
parent 6bb4199824
commit 77244eab1e
2 changed files with 5 additions and 5 deletions

View File

@ -51,11 +51,11 @@ CUSTOM_WARNING = (
_UNDEF = object() _UNDEF = object()
def manifest_from_legacy_module(module: ModuleType) -> Dict: def manifest_from_legacy_module(domain: str, module: ModuleType) -> Dict:
"""Generate a manifest from a legacy module.""" """Generate a manifest from a legacy module."""
return { return {
'domain': module.DOMAIN, # type: ignore 'domain': domain,
'name': module.DOMAIN, # type: ignore 'name': domain,
'documentation': None, 'documentation': None,
'requirements': getattr(module, 'REQUIREMENTS', []), 'requirements': getattr(module, 'REQUIREMENTS', []),
'dependencies': getattr(module, 'DEPENDENCIES', []), 'dependencies': getattr(module, 'DEPENDENCIES', []),
@ -106,7 +106,7 @@ class Integration:
return cls( return cls(
hass, comp.__name__, pathlib.Path(comp.__file__).parent, hass, comp.__name__, pathlib.Path(comp.__file__).parent,
manifest_from_legacy_module(comp) manifest_from_legacy_module(domain, comp)
) )
def __init__(self, hass: 'HomeAssistant', pkg_path: str, def __init__(self, hass: 'HomeAssistant', pkg_path: str,

View File

@ -487,7 +487,7 @@ class MockModule:
def mock_manifest(self): def mock_manifest(self):
"""Generate a mock manifest to represent this module.""" """Generate a mock manifest to represent this module."""
return { return {
**loader.manifest_from_legacy_module(self), **loader.manifest_from_legacy_module(self.DOMAIN, self),
**(self._partial_manifest or {}) **(self._partial_manifest or {})
} }