Custom component loading cleanup (#14211)

* Clean up custom component loading

* Fix some tests

* Fix some stuff

* Make imports work again

* Fix tests

* Remove debug print

* Lint
This commit is contained in:
Paulus Schoutsen authored and Pascal Vizeli committed 2018-05-01 20:57:30 +02:00
1 parent 5d96751168
commit 83d300fd11
50 files changed
+315 -392

No files matched your search

@@ -17,10 +17,10 @@ from homeassistant.loader import set_component
from tests.common import MockConfigEntry, MockModule, mock_coro_func
@pytest.fixture(scope='session', autouse=True)
def mock_test_component():
@pytest.fixture(autouse=True)
def mock_test_component(hass):
"""Ensure a component called 'test' exists."""
set_component('test', MockModule('test'))
set_component(hass, 'test', MockModule('test'))
@pytest.fixture
@@ -172,7 +172,8 @@ def test_abort(hass, client):
def test_create_account(hass, client):
"""Test a flow that creates an account."""
set_component(
'test', MockModule('test', async_setup_entry=mock_coro_func(True)))
hass, 'test',
MockModule('test', async_setup_entry=mock_coro_func(True)))
class TestFlow(FlowHandler):
VERSION = 1
@@ -204,7 +205,8 @@ def test_create_account(hass, client):
def test_two_step_flow(hass, client):
"""Test we can finish a two step flow."""
set_component(
'test', MockModule('test', async_setup_entry=mock_coro_func(True)))
hass, 'test',
MockModule('test', async_setup_entry=mock_coro_func(True)))
class TestFlow(FlowHandler):
VERSION = 1