Fix broken tests (#3704)

* Fix broken tests

* Lint
This commit is contained in:
Paulus Schoutsen 2016-10-04 22:19:12 -07:00 committed by GitHub
parent dc53c21548
commit 4f0064b00e
3 changed files with 4 additions and 8 deletions

View file

@ -204,8 +204,6 @@ class HomeAssistant(object):
except KeyboardInterrupt: except KeyboardInterrupt:
self.loop.call_soon(stop_homeassistant) self.loop.call_soon(stop_homeassistant)
self.loop.run_forever() self.loop.run_forever()
finally:
self.loop.close()
@asyncio.coroutine @asyncio.coroutine
def async_start(self): def async_start(self):

View file

@ -79,8 +79,9 @@ def get_test_home_assistant(num_threads=None):
with patch.object(ha, 'async_create_timer', return_value=None): with patch.object(ha, 'async_create_timer', return_value=None):
with patch.object(ha, 'async_monitor_worker_pool', with patch.object(ha, 'async_monitor_worker_pool',
return_value=None): return_value=None):
orig_start() with patch.object(hass.loop, 'add_signal_handler'):
hass.block_till_done() orig_start()
hass.block_till_done()
def stop_hass(): def stop_hass():
orig_stop() orig_stop()

View file

@ -2,8 +2,6 @@
# pylint: disable=protected-access,too-many-public-methods # pylint: disable=protected-access,too-many-public-methods
# pylint: disable=too-few-public-methods # pylint: disable=too-few-public-methods
import asyncio import asyncio
import os
import signal
import unittest import unittest
from unittest.mock import patch, MagicMock from unittest.mock import patch, MagicMock
from datetime import datetime, timedelta from datetime import datetime, timedelta
@ -15,8 +13,7 @@ from homeassistant.exceptions import InvalidEntityFormatError
import homeassistant.util.dt as dt_util import homeassistant.util.dt as dt_util
from homeassistant.util.unit_system import (METRIC_SYSTEM) from homeassistant.util.unit_system import (METRIC_SYSTEM)
from homeassistant.const import ( from homeassistant.const import (
__version__, EVENT_HOMEASSISTANT_START, EVENT_HOMEASSISTANT_STOP, __version__, EVENT_STATE_CHANGED, ATTR_FRIENDLY_NAME, CONF_UNIT_SYSTEM)
EVENT_STATE_CHANGED, ATTR_FRIENDLY_NAME, CONF_UNIT_SYSTEM)
from tests.common import get_test_home_assistant from tests.common import get_test_home_assistant