mirror of
https://github.com/home-assistant/core.git
synced 2025-04-25 01:38:02 +00:00
Fix platform dependencies (#12330)
This commit is contained in:
parent
ebe4418afe
commit
04b68902e3
@ -206,7 +206,7 @@ def async_prepare_setup_platform(hass: core.HomeAssistant, config, domain: str,
|
|||||||
return platform
|
return platform
|
||||||
|
|
||||||
try:
|
try:
|
||||||
yield from _process_deps_reqs(hass, config, platform_name, platform)
|
yield from _process_deps_reqs(hass, config, platform_path, platform)
|
||||||
except HomeAssistantError as err:
|
except HomeAssistantError as err:
|
||||||
log_error(str(err))
|
log_error(str(err))
|
||||||
return None
|
return None
|
||||||
|
@ -12,7 +12,7 @@ import homeassistant.loader as loader
|
|||||||
from homeassistant.exceptions import PlatformNotReady
|
from homeassistant.exceptions import PlatformNotReady
|
||||||
from homeassistant.components import group
|
from homeassistant.components import group
|
||||||
from homeassistant.helpers.entity_component import EntityComponent
|
from homeassistant.helpers.entity_component import EntityComponent
|
||||||
from homeassistant.setup import setup_component
|
from homeassistant.setup import setup_component, async_setup_component
|
||||||
|
|
||||||
from homeassistant.helpers import discovery
|
from homeassistant.helpers import discovery
|
||||||
import homeassistant.util.dt as dt_util
|
import homeassistant.util.dt as dt_util
|
||||||
@ -305,3 +305,31 @@ def test_extract_from_service_no_group_expand(hass):
|
|||||||
|
|
||||||
extracted = component.async_extract_from_service(call, expand_group=False)
|
extracted = component.async_extract_from_service(call, expand_group=False)
|
||||||
assert extracted == [test_group]
|
assert extracted == [test_group]
|
||||||
|
|
||||||
|
|
||||||
|
@asyncio.coroutine
|
||||||
|
def test_setup_dependencies_platform(hass):
|
||||||
|
"""Test we setup the dependencies of a platform.
|
||||||
|
|
||||||
|
We're explictely testing that we process dependencies even if a component
|
||||||
|
with the same name has already been loaded.
|
||||||
|
"""
|
||||||
|
loader.set_component('test_component', MockModule('test_component'))
|
||||||
|
loader.set_component('test_component2', MockModule('test_component2'))
|
||||||
|
loader.set_component(
|
||||||
|
'test_domain.test_component',
|
||||||
|
MockPlatform(dependencies=['test_component', 'test_component2']))
|
||||||
|
|
||||||
|
component = EntityComponent(_LOGGER, DOMAIN, hass)
|
||||||
|
|
||||||
|
yield from async_setup_component(hass, 'test_component', {})
|
||||||
|
|
||||||
|
yield from component.async_setup({
|
||||||
|
DOMAIN: {
|
||||||
|
'platform': 'test_component',
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
assert 'test_component' in hass.config.components
|
||||||
|
assert 'test_component2' in hass.config.components
|
||||||
|
assert 'test_domain.test_component' in hass.config.components
|
||||||
|
Loading…
x
Reference in New Issue
Block a user