Do async_setup_platform in background (#36244)

Co-authored-by: J. Nick Koston <nick@koston.org>
This commit is contained in:
Paulus SchoutsenandJ. Nick Koston authored and GitHub committed 2020-05-31 22:18:30 -07:00
1 parent d488c779fc
commit 276f3afb00
161 files changed
+1184 -305

No files matched your search

+7
View File
@@ -96,6 +96,7 @@ class TestHDDTempSensor(unittest.TestCase):
def test_hddtemp_min_config(self):
"""Test minimal hddtemp configuration."""
assert setup_component(self.hass, "sensor", VALID_CONFIG_MINIMAL)
self.hass.block_till_done()
entity = self.hass.states.all()[0].entity_id
state = self.hass.states.get(entity)
@@ -118,6 +119,7 @@ class TestHDDTempSensor(unittest.TestCase):
def test_hddtemp_rename_config(self):
"""Test hddtemp configuration with different name."""
assert setup_component(self.hass, "sensor", VALID_CONFIG_NAME)
self.hass.block_till_done()
entity = self.hass.states.all()[0].entity_id
state = self.hass.states.get(entity)
@@ -130,6 +132,7 @@ class TestHDDTempSensor(unittest.TestCase):
def test_hddtemp_one_disk(self):
"""Test hddtemp one disk configuration."""
assert setup_component(self.hass, "sensor", VALID_CONFIG_ONE_DISK)
self.hass.block_till_done()
state = self.hass.states.get("sensor.hd_temperature_dev_sdd1")
@@ -151,6 +154,7 @@ class TestHDDTempSensor(unittest.TestCase):
def test_hddtemp_wrong_disk(self):
"""Test hddtemp wrong disk configuration."""
assert setup_component(self.hass, "sensor", VALID_CONFIG_WRONG_DISK)
self.hass.block_till_done()
assert len(self.hass.states.all()) == 1
state = self.hass.states.get("sensor.hd_temperature_dev_sdx1")
@@ -160,6 +164,7 @@ class TestHDDTempSensor(unittest.TestCase):
def test_hddtemp_multiple_disks(self):
"""Test hddtemp multiple disk configuration."""
assert setup_component(self.hass, "sensor", VALID_CONFIG_MULTIPLE_DISKS)
self.hass.block_till_done()
for sensor in [
"sensor.hd_temperature_dev_sda1",
@@ -187,10 +192,12 @@ class TestHDDTempSensor(unittest.TestCase):
def test_hddtemp_host_refused(self):
"""Test hddtemp if host unreachable."""
assert setup_component(self.hass, "sensor", VALID_CONFIG_HOST)
self.hass.block_till_done()
assert len(self.hass.states.all()) == 0
@patch("telnetlib.Telnet", new=TelnetMock)
def test_hddtemp_host_unreachable(self):
"""Test hddtemp if host unreachable."""
assert setup_component(self.hass, "sensor", VALID_CONFIG_HOST_UNREACHABLE)
self.hass.block_till_done()
assert len(self.hass.states.all()) == 0