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

Track tasks only during shutdown and tests (#4428)

* Track tasks only when needed

* Tweak async_block_till_done
This commit is contained in:
Paulus Schoutsen
2016-11-24 14:49:29 -08:00
committed by GitHub
parent 42c99b0ccb
commit eacdce9ed9
4 changed files with 42 additions and 48 deletions

View File

@@ -82,6 +82,7 @@ def async_test_home_assistant(loop):
loop._thread_ident = threading.get_ident()
hass = ha.HomeAssistant(loop)
hass.async_track_tasks()
hass.config.location_name = 'test home'
hass.config.config_dir = get_test_config_dir()
@@ -103,9 +104,8 @@ def async_test_home_assistant(loop):
@asyncio.coroutine
def mock_async_start():
"""Start the mocking."""
with patch.object(loop, 'add_signal_handler'),\
patch('homeassistant.core._async_create_timer'),\
patch.object(hass, '_async_tasks_cleanup', return_value=None):
with patch.object(loop, 'add_signal_handler'), \
patch('homeassistant.core._async_create_timer'):
yield from orig_start()
hass.async_start = mock_async_start