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
|
@ -5,18 +5,19 @@ import tempfile
|
|||
import unittest
|
||||
from unittest import mock
|
||||
|
||||
import homeassistant.core as ha
|
||||
import homeassistant.components.cover as cover
|
||||
from homeassistant.components.cover import (
|
||||
command_line as cmd_rs)
|
||||
|
||||
from tests.common import get_test_home_assistant
|
||||
|
||||
|
||||
class TestCommandCover(unittest.TestCase):
|
||||
"""Test the cover command line platform."""
|
||||
|
||||
def setup_method(self, method):
|
||||
"""Setup things to be run when tests are started."""
|
||||
self.hass = ha.HomeAssistant()
|
||||
self.hass = get_test_home_assistant()
|
||||
self.rs = cmd_rs.CommandCover(self.hass, 'foo',
|
||||
'command_open', 'command_close',
|
||||
'command_stop', 'command_state',
|
||||
|
@ -64,19 +65,19 @@ class TestCommandCover(unittest.TestCase):
|
|||
self.assertEqual('unknown', state.state)
|
||||
|
||||
cover.open_cover(self.hass, 'cover.test')
|
||||
self.hass.pool.block_till_done()
|
||||
self.hass.block_till_done()
|
||||
|
||||
state = self.hass.states.get('cover.test')
|
||||
self.assertEqual('open', state.state)
|
||||
|
||||
cover.close_cover(self.hass, 'cover.test')
|
||||
self.hass.pool.block_till_done()
|
||||
self.hass.block_till_done()
|
||||
|
||||
state = self.hass.states.get('cover.test')
|
||||
self.assertEqual('open', state.state)
|
||||
|
||||
cover.stop_cover(self.hass, 'cover.test')
|
||||
self.hass.pool.block_till_done()
|
||||
self.hass.block_till_done()
|
||||
|
||||
state = self.hass.states.get('cover.test')
|
||||
self.assertEqual('closed', state.state)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue