Limit worker pool to 10 threads (#3560)
* Limit worker pool to 10 threads * Comment evdev in requirements * Allow skipping RFXtrx tests locally * Fix worker pool size tests * lol whut
This commit is contained in:
1 parent
a084232cf5
commit
4b8bc90d16
15 files changed
+41
-5
No files matched your search
@@ -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:
|
||||
|
||||
@@ -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."""
|
||||
|
||||
|
||||
@@ -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."""
|
||||
|
||||
|
||||
@@ -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."""
|
||||
|
||||
|
||||
@@ -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."""
|
||||
|
||||
|
||||
@@ -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."""
|
||||
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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]
|
||||
|
||||
|
||||
@@ -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]
|
||||
|
||||
|
||||
@@ -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]
|
||||
|
||||
|
||||
@@ -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]
|
||||
|
||||
Reference in new issue
Block a user