Move mocks to async_start (#4182)

This commit is contained in:
Paulus Schoutsen 2016-11-02 19:16:59 -07:00 committed by GitHub
parent 26490109ac
commit 4e820ea30a

View file

@ -58,8 +58,6 @@ def get_test_home_assistant():
orig_start = hass.start
orig_stop = hass.stop
@patch.object(hass.loop, 'add_signal_handler')
@patch.object(ha, '_async_create_timer')
@patch.object(hass.loop, 'run_forever')
@patch.object(hass.loop, 'close')
def start_hass(*mocks):
@ -100,6 +98,19 @@ def async_test_home_assistant(loop):
hass.state = ha.CoreState.running
hass.allow_pool = False
# Mock async_start
orig_start = hass.async_start
@asyncio.coroutine
def mock_async_start():
with patch.object(loop, 'add_signal_handler'), \
patch('homeassistant.core._async_create_timer'):
yield from orig_start()
hass.async_start = mock_async_start
# Mock async_init_pool
orig_init = hass.async_init_pool
@ha.callback