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
|
@ -66,7 +66,7 @@ class TestAlarmControlPanelMQTT(unittest.TestCase):
|
|||
STATE_ALARM_ARMED_AWAY, STATE_ALARM_PENDING,
|
||||
STATE_ALARM_TRIGGERED):
|
||||
fire_mqtt_message(self.hass, 'alarm/state', state)
|
||||
self.hass.pool.block_till_done()
|
||||
self.hass.block_till_done()
|
||||
self.assertEqual(state, self.hass.states.get(entity_id).state)
|
||||
|
||||
def test_ignore_update_state_if_unknown_via_state_topic(self):
|
||||
|
@ -87,7 +87,7 @@ class TestAlarmControlPanelMQTT(unittest.TestCase):
|
|||
self.hass.states.get(entity_id).state)
|
||||
|
||||
fire_mqtt_message(self.hass, 'alarm/state', 'unsupported state')
|
||||
self.hass.pool.block_till_done()
|
||||
self.hass.block_till_done()
|
||||
self.assertEqual(STATE_UNKNOWN, self.hass.states.get(entity_id).state)
|
||||
|
||||
def test_arm_home_publishes_mqtt(self):
|
||||
|
@ -103,7 +103,7 @@ class TestAlarmControlPanelMQTT(unittest.TestCase):
|
|||
})
|
||||
|
||||
alarm_control_panel.alarm_arm_home(self.hass)
|
||||
self.hass.pool.block_till_done()
|
||||
self.hass.block_till_done()
|
||||
self.assertEqual(('alarm/command', 'ARM_HOME', 0, False),
|
||||
self.mock_publish.mock_calls[-1][1])
|
||||
|
||||
|
@ -122,7 +122,7 @@ class TestAlarmControlPanelMQTT(unittest.TestCase):
|
|||
|
||||
call_count = self.mock_publish.call_count
|
||||
alarm_control_panel.alarm_arm_home(self.hass, 'abcd')
|
||||
self.hass.pool.block_till_done()
|
||||
self.hass.block_till_done()
|
||||
self.assertEqual(call_count, self.mock_publish.call_count)
|
||||
|
||||
def test_arm_away_publishes_mqtt(self):
|
||||
|
@ -138,7 +138,7 @@ class TestAlarmControlPanelMQTT(unittest.TestCase):
|
|||
})
|
||||
|
||||
alarm_control_panel.alarm_arm_away(self.hass)
|
||||
self.hass.pool.block_till_done()
|
||||
self.hass.block_till_done()
|
||||
self.assertEqual(('alarm/command', 'ARM_AWAY', 0, False),
|
||||
self.mock_publish.mock_calls[-1][1])
|
||||
|
||||
|
@ -157,7 +157,7 @@ class TestAlarmControlPanelMQTT(unittest.TestCase):
|
|||
|
||||
call_count = self.mock_publish.call_count
|
||||
alarm_control_panel.alarm_arm_away(self.hass, 'abcd')
|
||||
self.hass.pool.block_till_done()
|
||||
self.hass.block_till_done()
|
||||
self.assertEqual(call_count, self.mock_publish.call_count)
|
||||
|
||||
def test_disarm_publishes_mqtt(self):
|
||||
|
@ -173,7 +173,7 @@ class TestAlarmControlPanelMQTT(unittest.TestCase):
|
|||
})
|
||||
|
||||
alarm_control_panel.alarm_disarm(self.hass)
|
||||
self.hass.pool.block_till_done()
|
||||
self.hass.block_till_done()
|
||||
self.assertEqual(('alarm/command', 'DISARM', 0, False),
|
||||
self.mock_publish.mock_calls[-1][1])
|
||||
|
||||
|
@ -192,5 +192,5 @@ class TestAlarmControlPanelMQTT(unittest.TestCase):
|
|||
|
||||
call_count = self.mock_publish.call_count
|
||||
alarm_control_panel.alarm_disarm(self.hass, 'abcd')
|
||||
self.hass.pool.block_till_done()
|
||||
self.hass.block_till_done()
|
||||
self.assertEqual(call_count, self.mock_publish.call_count)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue