Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion homeassistant/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ def log_error(msg):
return platform

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:
log_error(str(err))
return None
Expand Down
30 changes: 29 additions & 1 deletion tests/helpers/test_entity_component.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from homeassistant.exceptions import PlatformNotReady
from homeassistant.components import group
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
import homeassistant.util.dt as dt_util
Expand Down Expand Up @@ -305,3 +305,31 @@ def test_extract_from_service_no_group_expand(hass):

extracted = component.async_extract_from_service(call, expand_group=False)
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