1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 21:06:19 +00:00

Update platform loading path (#20807)

* Warn when platform loaded from an entity component folder

* Fix tests
This commit is contained in:
Paulus Schoutsen
2019-02-07 13:33:12 -08:00
committed by GitHub
parent e0f63132e8
commit 16159cc3d0
5 changed files with 33 additions and 9 deletions

View File

@@ -132,3 +132,17 @@ async def test_log_warning_custom_component(hass, caplog):
loader.get_component(hass, 'light.test')
assert 'You are using a custom component for light.test' in caplog.text
async def test_get_platform(hass, caplog):
"""Test get_platform."""
# Test we prefer embedded over normal platforms."""
embedded_platform = loader.get_platform(hass, 'switch', 'test_embedded')
assert embedded_platform.__name__ == \
'custom_components.test_embedded.switch'
caplog.clear()
legacy_platform = loader.get_platform(hass, 'switch', 'test')
assert legacy_platform.__name__ == 'custom_components.switch.test'
assert 'Integrations need to be in their own folder.' in caplog.text