Update platform loading path (#20807)
* Warn when platform loaded from an entity component folder * Fix tests
This commit is contained in:
1 parent
e0f63132e8
commit
16159cc3d0
5 files changed
+33
-9
No files matched your search
@@ -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