mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 21:06:19 +00:00
Bugfix wait on start event (#7013)
* Bugfix wait on start event * Paulus sugestion * Change handling with stop_track_task * Add new unittests * Update test_core.py
This commit is contained in:
committed by
Paulus Schoutsen
parent
cc459e25cc
commit
b52cabf2c0
@@ -901,7 +901,6 @@ def test_start_taking_too_long(loop, caplog):
|
||||
patch('homeassistant.core._async_create_timer') as mock_timer:
|
||||
yield from hass.async_start()
|
||||
|
||||
assert not hass._track_task
|
||||
assert hass.state == ha.CoreState.running
|
||||
assert len(mock_timer.mock_calls) == 1
|
||||
assert mock_timer.mock_calls[0][1][0] is hass
|
||||
@@ -910,3 +909,19 @@ def test_start_taking_too_long(loop, caplog):
|
||||
finally:
|
||||
yield from hass.async_stop()
|
||||
assert hass.state == ha.CoreState.not_running
|
||||
|
||||
|
||||
@asyncio.coroutine
|
||||
def test_track_task_functions(loop):
|
||||
"""Test function to start/stop track task and initial state."""
|
||||
hass = ha.HomeAssistant(loop=loop)
|
||||
try:
|
||||
assert hass._track_task
|
||||
|
||||
hass.async_stop_track_tasks()
|
||||
assert not hass._track_task
|
||||
|
||||
hass.async_track_tasks()
|
||||
assert hass._track_task
|
||||
finally:
|
||||
yield from hass.async_stop()
|
||||
|
||||
Reference in New Issue
Block a user