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
|
@ -85,7 +85,7 @@ class TestStateHelpers(unittest.TestCase):
|
|||
|
||||
state.reproduce_state(self.hass, ha.State('light.test', 'on'))
|
||||
|
||||
self.hass.pool.block_till_done()
|
||||
self.hass.block_till_done()
|
||||
|
||||
self.assertTrue(len(calls) == 0)
|
||||
self.assertEqual(None, self.hass.states.get('light.test'))
|
||||
|
@ -98,7 +98,7 @@ class TestStateHelpers(unittest.TestCase):
|
|||
|
||||
state.reproduce_state(self.hass, ha.State('light.test', 'on'))
|
||||
|
||||
self.hass.pool.block_till_done()
|
||||
self.hass.block_till_done()
|
||||
|
||||
self.assertTrue(len(calls) > 0)
|
||||
last_call = calls[-1]
|
||||
|
@ -114,7 +114,7 @@ class TestStateHelpers(unittest.TestCase):
|
|||
|
||||
state.reproduce_state(self.hass, ha.State('light.test', 'off'))
|
||||
|
||||
self.hass.pool.block_till_done()
|
||||
self.hass.block_till_done()
|
||||
|
||||
self.assertTrue(len(calls) > 0)
|
||||
last_call = calls[-1]
|
||||
|
@ -134,7 +134,7 @@ class TestStateHelpers(unittest.TestCase):
|
|||
'complex': complex_data
|
||||
}))
|
||||
|
||||
self.hass.pool.block_till_done()
|
||||
self.hass.block_till_done()
|
||||
|
||||
self.assertTrue(len(calls) > 0)
|
||||
last_call = calls[-1]
|
||||
|
@ -154,7 +154,7 @@ class TestStateHelpers(unittest.TestCase):
|
|||
state.reproduce_state(self.hass, ha.State('media_player.test', 'None',
|
||||
media_attributes))
|
||||
|
||||
self.hass.pool.block_till_done()
|
||||
self.hass.block_till_done()
|
||||
|
||||
self.assertTrue(len(calls) > 0)
|
||||
last_call = calls[-1]
|
||||
|
@ -172,7 +172,7 @@ class TestStateHelpers(unittest.TestCase):
|
|||
state.reproduce_state(
|
||||
self.hass, ha.State('media_player.test', 'playing'))
|
||||
|
||||
self.hass.pool.block_till_done()
|
||||
self.hass.block_till_done()
|
||||
|
||||
self.assertTrue(len(calls) > 0)
|
||||
last_call = calls[-1]
|
||||
|
@ -190,7 +190,7 @@ class TestStateHelpers(unittest.TestCase):
|
|||
state.reproduce_state(
|
||||
self.hass, ha.State('media_player.test', 'paused'))
|
||||
|
||||
self.hass.pool.block_till_done()
|
||||
self.hass.block_till_done()
|
||||
|
||||
self.assertTrue(len(calls) > 0)
|
||||
last_call = calls[-1]
|
||||
|
@ -207,7 +207,7 @@ class TestStateHelpers(unittest.TestCase):
|
|||
|
||||
state.reproduce_state(self.hass, ha.State('light.test', 'bad'))
|
||||
|
||||
self.hass.pool.block_till_done()
|
||||
self.hass.block_till_done()
|
||||
|
||||
self.assertTrue(len(calls) == 0)
|
||||
self.assertEqual('off', self.hass.states.get('light.test').state)
|
||||
|
@ -221,7 +221,7 @@ class TestStateHelpers(unittest.TestCase):
|
|||
|
||||
state.reproduce_state(self.hass, ha.State('group.test', 'on'))
|
||||
|
||||
self.hass.pool.block_till_done()
|
||||
self.hass.block_till_done()
|
||||
|
||||
self.assertEqual(1, len(light_calls))
|
||||
last_call = light_calls[-1]
|
||||
|
@ -241,7 +241,7 @@ class TestStateHelpers(unittest.TestCase):
|
|||
ha.State('light.test1', 'on', {'brightness': 95}),
|
||||
ha.State('light.test2', 'on', {'brightness': 95})])
|
||||
|
||||
self.hass.pool.block_till_done()
|
||||
self.hass.block_till_done()
|
||||
|
||||
self.assertEqual(1, len(light_calls))
|
||||
last_call = light_calls[-1]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue