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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user