diff --git a/homeassistant/bootstrap.py b/homeassistant/bootstrap.py index b2c1d256c4a42abe2886d9e4d76af76f21b02d17..21c56f55badfb404c20fa0365db4d339e7d057a4 100644 --- a/homeassistant/bootstrap.py +++ b/homeassistant/bootstrap.py @@ -118,7 +118,8 @@ def _setup_component(hass: core.HomeAssistant, domain: str, config) -> bool: # Assumption: if a component does not depend on groups # it communicates with devices - if 'group' not in getattr(component, 'DEPENDENCIES', []): + if 'group' not in getattr(component, 'DEPENDENCIES', []) and \ + hass.pool.worker_count <= 10: hass.pool.add_worker() hass.bus.fire( diff --git a/homeassistant/components/switch/rfxtrx.py b/homeassistant/components/switch/rfxtrx.py index 43f2fe6a86f1305a67d56883d3f923286b926f38..959bab5fe40120fb4727292fa8ee74b2e75fcb11 100644 --- a/homeassistant/components/switch/rfxtrx.py +++ b/homeassistant/components/switch/rfxtrx.py @@ -6,7 +6,6 @@ https://home-assistant.io/components/switch.rfxtrx/ """ import logging - import homeassistant.components.rfxtrx as rfxtrx from homeassistant.components.switch import SwitchDevice diff --git a/requirements_all.txt b/requirements_all.txt index ba021d93cb089c47f358d3feab3c030c31510eca..083865f8db20a3cadf10d6b0216957961193b1f0 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -81,7 +81,7 @@ eliqonline==1.0.12 enocean==0.31 # homeassistant.components.keyboard_remote -evdev==0.6.1 +# evdev==0.6.1 # homeassistant.components.climate.honeywell # homeassistant.components.thermostat.honeywell diff --git a/script/gen_requirements_all.py b/script/gen_requirements_all.py index 65ffa26116aa16861afa6b356595e961821f33ff..a5a25e7bab435ba3982abeead277497021f1ca10 100755 --- a/script/gen_requirements_all.py +++ b/script/gen_requirements_all.py @@ -16,6 +16,7 @@ COMMENT_REQUIREMENTS = ( 'python-lirc', 'gattlib', 'pyuserinput', + 'evdev', ) IGNORE_PACKAGES = ( diff --git a/tests/components/camera/test_uvc.py b/tests/components/camera/test_uvc.py index 10b5cf832f39cb3d4b8292e8e2840ee8b7d1cf40..01ce1cec518c69f4dcf3aa1a5edec6313e4a235a 100644 --- a/tests/components/camera/test_uvc.py +++ b/tests/components/camera/test_uvc.py @@ -38,6 +38,7 @@ class TestUVCSetup(unittest.TestCase): return {'model': 'UVC'} hass = mock.MagicMock() + hass.pool.worker_count = 2 hass.config.components = ['http'] mock_remote.return_value.index.return_value = fake_cameras mock_remote.return_value.get_camera.side_effect = fake_get_camera @@ -65,6 +66,7 @@ class TestUVCSetup(unittest.TestCase): {'uuid': 'two', 'name': 'Back', 'id': 'id2'}, ] hass = mock.MagicMock() + hass.pool.worker_count = 2 hass.config.components = ['http'] mock_remote.return_value.index.return_value = fake_cameras mock_remote.return_value.get_camera.return_value = {'model': 'UVC'} @@ -92,6 +94,7 @@ class TestUVCSetup(unittest.TestCase): {'uuid': 'two', 'name': 'Back', 'id': 'id2'}, ] hass = mock.MagicMock() + hass.pool.worker_count = 2 hass.config.components = ['http'] mock_remote.return_value.index.return_value = fake_cameras mock_remote.return_value.get_camera.return_value = {'model': 'UVC'} @@ -109,6 +112,7 @@ class TestUVCSetup(unittest.TestCase): def test_setup_incomplete_config(self, mock_uvc): """"Test the setup with incomplete configuration.""" hass = mock.MagicMock() + hass.pool.worker_count = 2 hass.config.components = ['http'] assert setup_component( @@ -133,6 +137,7 @@ class TestUVCSetup(unittest.TestCase): 'key': 'secret', } hass = mock.MagicMock() + hass.pool.worker_count = 2 hass.config.components = ['http'] for error in errors: diff --git a/tests/components/cover/test_rfxtrx.py b/tests/components/cover/test_rfxtrx.py index 96fecff2ee2d78a859580c188a46fbaea4dab040..a73a2b978dc54f7219ac745f1e0f53d2996f0300 100644 --- a/tests/components/cover/test_rfxtrx.py +++ b/tests/components/cover/test_rfxtrx.py @@ -1,12 +1,15 @@ """The tests for the Rfxtrx cover platform.""" import unittest +import pytest + from homeassistant.bootstrap import _setup_component from homeassistant.components import rfxtrx as rfxtrx_core from tests.common import get_test_home_assistant +@pytest.mark.skipif("os.environ.get('RFXTRX') == 'SKIP'") class TestCoverRfxtrx(unittest.TestCase): """Test the Rfxtrx cover platform.""" diff --git a/tests/components/light/test_rfxtrx.py b/tests/components/light/test_rfxtrx.py index cd4cecd8505ac506f45786308e59c96975307e6d..80014dfd1c16fbbe3f9658e5303c992916dfbec4 100644 --- a/tests/components/light/test_rfxtrx.py +++ b/tests/components/light/test_rfxtrx.py @@ -1,12 +1,15 @@ """The tests for the Rfxtrx light platform.""" import unittest +import pytest + from homeassistant.bootstrap import _setup_component from homeassistant.components import rfxtrx as rfxtrx_core from tests.common import get_test_home_assistant +@pytest.mark.skipif("os.environ.get('RFXTRX') == 'SKIP'") class TestLightRfxtrx(unittest.TestCase): """Test the Rfxtrx light platform.""" diff --git a/tests/components/rollershutter/test_rfxtrx.py b/tests/components/rollershutter/test_rfxtrx.py index 704fa9310e6cb3d8c31ad1ad8f723bf45d207fd3..1218ab37a59811cc4a6b22e2937f1b22e993c7b4 100644 --- a/tests/components/rollershutter/test_rfxtrx.py +++ b/tests/components/rollershutter/test_rfxtrx.py @@ -1,12 +1,15 @@ """The tests for the Rfxtrx roller shutter platform.""" import unittest +import pytest + from homeassistant.bootstrap import _setup_component from homeassistant.components import rfxtrx as rfxtrx_core from tests.common import get_test_home_assistant +@pytest.mark.skipif("os.environ.get('RFXTRX') == 'SKIP'") class TestRollershutterRfxtrx(unittest.TestCase): """Test the Rfxtrx roller shutter platform.""" diff --git a/tests/components/sensor/test_rfxtrx.py b/tests/components/sensor/test_rfxtrx.py index 2d38de5eab5096a7550a693b2f09ae261a0eeef7..e42aaea7e04d449a125089888496876590783303 100644 --- a/tests/components/sensor/test_rfxtrx.py +++ b/tests/components/sensor/test_rfxtrx.py @@ -1,6 +1,8 @@ """The tests for the Rfxtrx sensor platform.""" import unittest +import pytest + from homeassistant.bootstrap import _setup_component from homeassistant.components import rfxtrx as rfxtrx_core from homeassistant.const import TEMP_CELSIUS @@ -8,6 +10,7 @@ from homeassistant.const import TEMP_CELSIUS from tests.common import get_test_home_assistant +@pytest.mark.skipif("os.environ.get('RFXTRX') == 'SKIP'") class TestSensorRfxtrx(unittest.TestCase): """Test the Rfxtrx sensor platform.""" diff --git a/tests/components/switch/test_rfxtrx.py b/tests/components/switch/test_rfxtrx.py index 72c13bd0ba4c421793bb5095635b95c2e759ff9e..729abf6db063eca65c5148815e2e04b5c29fd0ee 100644 --- a/tests/components/switch/test_rfxtrx.py +++ b/tests/components/switch/test_rfxtrx.py @@ -1,12 +1,15 @@ """The tests for the Rfxtrx switch platform.""" import unittest +import pytest + from homeassistant.bootstrap import _setup_component from homeassistant.components import rfxtrx as rfxtrx_core from tests.common import get_test_home_assistant +@pytest.mark.skipif("os.environ.get('RFXTRX') == 'SKIP'") class TestSwitchRfxtrx(unittest.TestCase): """Test the Rfxtrx switch platform.""" diff --git a/tests/components/test_influxdb.py b/tests/components/test_influxdb.py index 7aa4fd616a9964fe72db466a14a8eab556bd0bf4..3210bf0db9feba475ca4045f34d3a3c3490a9f8a 100644 --- a/tests/components/test_influxdb.py +++ b/tests/components/test_influxdb.py @@ -17,6 +17,7 @@ class TestInfluxDB(unittest.TestCase): def setUp(self): """Setup things to be run when tests are started.""" self.hass = mock.MagicMock() + self.hass.pool.worker_count = 2 self.handler_method = None def test_setup_config_full(self, mock_client): diff --git a/tests/components/test_logentries.py b/tests/components/test_logentries.py index 8642c4aa9a293548f22e3b689f3f452995810e2a..94097fba32c79793ea9b28b192f065423ae2c755 100644 --- a/tests/components/test_logentries.py +++ b/tests/components/test_logentries.py @@ -19,6 +19,7 @@ class TestLogentries(unittest.TestCase): } } hass = mock.MagicMock() + hass.pool.worker_count = 2 self.assertTrue(setup_component(hass, logentries.DOMAIN, config)) self.assertTrue(hass.bus.listen.called) self.assertEqual(EVENT_STATE_CHANGED, @@ -32,6 +33,7 @@ class TestLogentries(unittest.TestCase): } } hass = mock.MagicMock() + hass.pool.worker_count = 2 self.assertTrue(setup_component(hass, logentries.DOMAIN, config)) self.assertTrue(hass.bus.listen.called) self.assertEqual(EVENT_STATE_CHANGED, @@ -48,6 +50,7 @@ class TestLogentries(unittest.TestCase): } } self.hass = mock.MagicMock() + self.hass.pool.worker_count = 2 setup_component(self.hass, logentries.DOMAIN, config) self.handler_method = self.hass.bus.listen.call_args_list[0][0][1] diff --git a/tests/components/test_logger.py b/tests/components/test_logger.py index 89577d8535db9e8ea555b65d2daeb2d928f31f97..e0243335dfa77a97c3fe5517d1c3e84dda8c5df3 100644 --- a/tests/components/test_logger.py +++ b/tests/components/test_logger.py @@ -24,7 +24,9 @@ class TestUpdater(unittest.TestCase): def test_logger_setup(self): """Use logger to create a logging filter.""" - setup_component(MagicMock(), logger.DOMAIN, self.log_config) + hass = MagicMock() + hass.pool.worker_count = 2 + setup_component(hass, logger.DOMAIN, self.log_config) self.assertTrue(len(logging.root.handlers) > 0) handler = logging.root.handlers[-1] @@ -37,7 +39,9 @@ class TestUpdater(unittest.TestCase): def test_logger_test_filters(self): """Test resulting filter operation.""" - setup_component(MagicMock(), logger.DOMAIN, self.log_config) + hass = MagicMock() + hass.pool.worker_count = 2 + setup_component(hass, logger.DOMAIN, self.log_config) log_filter = logging.root.handlers[-1].filters[0] diff --git a/tests/components/test_splunk.py b/tests/components/test_splunk.py index 7dcc3ca5f5cba88cc775b81179fe7ba75fd780b6..84dc4dfaac5c7e8b3d89ba434b171cd752454c03 100644 --- a/tests/components/test_splunk.py +++ b/tests/components/test_splunk.py @@ -22,6 +22,7 @@ class TestSplunk(unittest.TestCase): } hass = mock.MagicMock() + hass.pool.worker_count = 2 self.assertTrue(setup_component(hass, splunk.DOMAIN, config)) self.assertTrue(hass.bus.listen.called) self.assertEqual(EVENT_STATE_CHANGED, @@ -37,6 +38,7 @@ class TestSplunk(unittest.TestCase): } hass = mock.MagicMock() + hass.pool.worker_count = 2 self.assertTrue(setup_component(hass, splunk.DOMAIN, config)) self.assertTrue(hass.bus.listen.called) self.assertEqual(EVENT_STATE_CHANGED, @@ -56,6 +58,7 @@ class TestSplunk(unittest.TestCase): } self.hass = mock.MagicMock() + self.hass.pool.worker_count = 2 setup_component(self.hass, splunk.DOMAIN, config) self.handler_method = self.hass.bus.listen.call_args_list[0][0][1] diff --git a/tests/components/test_statsd.py b/tests/components/test_statsd.py index ff3647674fd81294e845ecdfc3c6a0b5c94f5d6c..6cbb26b7416e0313e5647021d2af43a0e9322c57 100644 --- a/tests/components/test_statsd.py +++ b/tests/components/test_statsd.py @@ -38,6 +38,7 @@ class TestStatsd(unittest.TestCase): } } hass = mock.MagicMock() + hass.pool.worker_count = 2 self.assertTrue(setup_component(hass, statsd.DOMAIN, config)) mock_connection.assert_called_once_with( host='host', @@ -61,6 +62,7 @@ class TestStatsd(unittest.TestCase): config['statsd'][statsd.CONF_PREFIX] = statsd.DEFAULT_PREFIX hass = mock.MagicMock() + hass.pool.worker_count = 2 self.assertTrue(setup_component(hass, statsd.DOMAIN, config)) mock_connection.assert_called_once_with( host='host', @@ -80,6 +82,7 @@ class TestStatsd(unittest.TestCase): config['statsd'][statsd.CONF_RATE] = statsd.DEFAULT_RATE hass = mock.MagicMock() + hass.pool.worker_count = 2 setup_component(hass, statsd.DOMAIN, config) self.assertTrue(hass.bus.listen.called) handler_method = hass.bus.listen.call_args_list[0][0][1] @@ -121,6 +124,7 @@ class TestStatsd(unittest.TestCase): config['statsd'][statsd.CONF_RATE] = statsd.DEFAULT_RATE hass = mock.MagicMock() + hass.pool.worker_count = 2 setup_component(hass, statsd.DOMAIN, config) self.assertTrue(hass.bus.listen.called) handler_method = hass.bus.listen.call_args_list[0][0][1]