Migrate core from threads to async awesomeness (#3248)
* Add event loop to the core * Add block_till_done to HA core object * Fix some tests * Linting core * Fix statemachine tests * Core test fixes * fix block_till_done to wait for loop and queue to empty * fix test_core for passing, and correct start/stop/block_till_done * Fix remote tests * Fix tests: block_till_done * Fix linting * Fix more tests * Fix final linting * Fix remote test * remove unnecessary import * reduce sleep to avoid slowing down the tests excessively * fix remaining tests to wait for non-threadsafe operations * Add async_ doc strings for event loop / coroutine info * Fix command line test to block for the right timeout * Fix py3.4.2 loop var access * Fix SERVICE_CALL_LIMIT being in effect for other tests * Fix lint errors * Fix lint error with proper placement * Fix slave start to not start a timer * Add asyncio compatible listeners. * Increase min Python version to 3.4.2 * Move async backports to util * Add backported async tests * Fix linting * Simplify Python version check * Fix lint * Remove unneeded try/except and queue listener appproriately. * Fix tuple vs. list unorderable error on version compare. * Fix version tests
This commit is contained in:
parent
24f1bff7f1
commit
609d7ebea5
98 changed files with 1680 additions and 1109 deletions
|
@ -45,7 +45,7 @@ class TestScriptHelper(unittest.TestCase):
|
|||
|
||||
script_obj.run()
|
||||
|
||||
self.hass.pool.block_till_done()
|
||||
self.hass.block_till_done()
|
||||
|
||||
assert len(calls) == 1
|
||||
assert calls[0].data.get('hello') == 'world'
|
||||
|
@ -69,7 +69,7 @@ class TestScriptHelper(unittest.TestCase):
|
|||
})
|
||||
|
||||
script_obj.run()
|
||||
self.hass.pool.block_till_done()
|
||||
self.hass.block_till_done()
|
||||
|
||||
assert len(calls) == 1
|
||||
assert calls[0].data.get('hello') == 'world'
|
||||
|
@ -104,7 +104,7 @@ class TestScriptHelper(unittest.TestCase):
|
|||
|
||||
script_obj.run()
|
||||
|
||||
self.hass.pool.block_till_done()
|
||||
self.hass.block_till_done()
|
||||
|
||||
assert len(calls) == 1
|
||||
assert calls[0].data.get('hello') == 'world'
|
||||
|
@ -127,7 +127,7 @@ class TestScriptHelper(unittest.TestCase):
|
|||
|
||||
script_obj.run()
|
||||
|
||||
self.hass.pool.block_till_done()
|
||||
self.hass.block_till_done()
|
||||
|
||||
assert script_obj.is_running
|
||||
assert script_obj.can_cancel
|
||||
|
@ -136,7 +136,7 @@ class TestScriptHelper(unittest.TestCase):
|
|||
|
||||
future = dt_util.utcnow() + timedelta(seconds=5)
|
||||
fire_time_changed(self.hass, future)
|
||||
self.hass.pool.block_till_done()
|
||||
self.hass.block_till_done()
|
||||
|
||||
assert not script_obj.is_running
|
||||
assert len(events) == 2
|
||||
|
@ -159,7 +159,7 @@ class TestScriptHelper(unittest.TestCase):
|
|||
|
||||
script_obj.run()
|
||||
|
||||
self.hass.pool.block_till_done()
|
||||
self.hass.block_till_done()
|
||||
|
||||
assert script_obj.is_running
|
||||
assert script_obj.can_cancel
|
||||
|
@ -168,7 +168,7 @@ class TestScriptHelper(unittest.TestCase):
|
|||
|
||||
future = dt_util.utcnow() + timedelta(seconds=5)
|
||||
fire_time_changed(self.hass, future)
|
||||
self.hass.pool.block_till_done()
|
||||
self.hass.block_till_done()
|
||||
|
||||
assert not script_obj.is_running
|
||||
assert len(events) == 2
|
||||
|
@ -190,7 +190,7 @@ class TestScriptHelper(unittest.TestCase):
|
|||
|
||||
script_obj.run()
|
||||
|
||||
self.hass.pool.block_till_done()
|
||||
self.hass.block_till_done()
|
||||
|
||||
assert script_obj.is_running
|
||||
assert len(events) == 0
|
||||
|
@ -202,7 +202,7 @@ class TestScriptHelper(unittest.TestCase):
|
|||
# Make sure the script is really stopped.
|
||||
future = dt_util.utcnow() + timedelta(seconds=5)
|
||||
fire_time_changed(self.hass, future)
|
||||
self.hass.pool.block_till_done()
|
||||
self.hass.block_till_done()
|
||||
|
||||
assert not script_obj.is_running
|
||||
assert len(events) == 0
|
||||
|
@ -237,7 +237,7 @@ class TestScriptHelper(unittest.TestCase):
|
|||
'greeting2': 'universe',
|
||||
})
|
||||
|
||||
self.hass.pool.block_till_done()
|
||||
self.hass.block_till_done()
|
||||
|
||||
assert script_obj.is_running
|
||||
assert len(calls) == 1
|
||||
|
@ -245,7 +245,7 @@ class TestScriptHelper(unittest.TestCase):
|
|||
|
||||
future = dt_util.utcnow() + timedelta(seconds=5)
|
||||
fire_time_changed(self.hass, future)
|
||||
self.hass.pool.block_till_done()
|
||||
self.hass.block_till_done()
|
||||
|
||||
assert not script_obj.is_running
|
||||
assert len(calls) == 2
|
||||
|
@ -274,11 +274,11 @@ class TestScriptHelper(unittest.TestCase):
|
|||
])
|
||||
|
||||
script_obj.run()
|
||||
self.hass.pool.block_till_done()
|
||||
self.hass.block_till_done()
|
||||
assert len(events) == 2
|
||||
|
||||
self.hass.states.set('test.entity', 'goodbye')
|
||||
|
||||
script_obj.run()
|
||||
self.hass.pool.block_till_done()
|
||||
self.hass.block_till_done()
|
||||
assert len(events) == 3
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue