Move signal handling out of core to bootstrap (#5815)

* Move signal handling out of core to bootstrap

* Fix tests
This commit is contained in:
Pascal Vizeli authored and Paulus Schoutsen committed 2017-02-08 21:58:45 -08:00
1 parent 7eb4bdc37b
commit 2cbed9cd96
7 files changed
+44 -26

No files matched your search

+1 -2
View File
@@ -108,8 +108,7 @@ def async_test_home_assistant(loop):
@asyncio.coroutine
def mock_async_start():
"""Start the mocking."""
with patch.object(loop, 'add_signal_handler'), \
patch('homeassistant.core._async_create_timer'):
with patch('homeassistant.core._async_create_timer'):
yield from orig_start()
hass.async_start = mock_async_start
+2 -1
View File
@@ -155,7 +155,8 @@ class TestHelpersDiscovery:
assert 'test_component' in self.hass.config.components
assert 'switch' in self.hass.config.components
def test_1st_discovers_2nd_component(self):
@patch('homeassistant.bootstrap.async_register_signal_handling')
def test_1st_discovers_2nd_component(self, mock_signal):
"""Test that we don't break if one component discovers the other.
If the first component fires a discovery event to setup the
+6 -3
View File
@@ -58,7 +58,8 @@ class TestBootstrap:
autospec=True)
@mock.patch('homeassistant.util.location.detect_location_info',
autospec=True, return_value=None)
def test_from_config_file(self, mock_upgrade, mock_detect):
@mock.patch('homeassistant.helpers.signal.async_register_signal_handling')
def test_from_config_file(self, mock_upgrade, mock_detect, mock_signal):
"""Test with configuration file."""
components = ['browser', 'conversation', 'script']
files = {
@@ -289,7 +290,8 @@ class TestBootstrap:
assert 'comp' not in self.hass.config.components
@mock.patch('homeassistant.bootstrap.enable_logging')
def test_home_assistant_core_config_validation(self, log_mock):
@mock.patch('homeassistant.helpers.signal.async_register_signal_handling')
def test_home_assistant_core_config_validation(self, log_mock, sig_mock):
"""Test if we pass in wrong information for HA conf."""
# Extensive HA conf validation testing is done in test_config.py
assert None is bootstrap.from_config_dict({
@@ -393,7 +395,8 @@ class TestBootstrap:
assert loader.get_component('disabled_component') is not None
assert 'disabled_component' in self.hass.config.components
def test_all_work_done_before_start(self):
@mock.patch('homeassistant.bootstrap.async_register_signal_handling')
def test_all_work_done_before_start(self, signal_mock):
"""Test all init work done till start."""
call_order = []