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

+20 -1
View File
@@ -36,7 +36,7 @@ async def test_valid_config(hass):
}
},
)
await hass.async_block_till_done()
state = hass.states.get("switch.flux")
assert state
assert state.state == "off"
@@ -57,6 +57,7 @@ async def test_restore_state_last_on(hass):
}
},
)
await hass.async_block_till_done()
state = hass.states.get("switch.flux")
assert state
@@ -78,6 +79,7 @@ async def test_restore_state_last_off(hass):
}
},
)
await hass.async_block_till_done()
state = hass.states.get("switch.flux")
assert state
@@ -129,6 +131,7 @@ async def test_flux_when_switch_is_off(hass):
assert await async_setup_component(
hass, light.DOMAIN, {light.DOMAIN: {CONF_PLATFORM: "test"}}
)
await hass.async_block_till_done()
ent1 = platform.ENTITIES[0]
@@ -178,6 +181,7 @@ async def test_flux_before_sunrise(hass):
assert await async_setup_component(
hass, light.DOMAIN, {light.DOMAIN: {CONF_PLATFORM: "test"}}
)
await hass.async_block_till_done()
ent1 = platform.ENTITIES[0]
@@ -231,6 +235,7 @@ async def test_flux_before_sunrise_known_location(hass):
assert await async_setup_component(
hass, light.DOMAIN, {light.DOMAIN: {CONF_PLATFORM: "test"}}
)
await hass.async_block_till_done()
ent1 = platform.ENTITIES[0]
@@ -284,6 +289,7 @@ async def test_flux_after_sunrise_before_sunset(hass):
assert await async_setup_component(
hass, light.DOMAIN, {light.DOMAIN: {CONF_PLATFORM: "test"}}
)
await hass.async_block_till_done()
ent1 = platform.ENTITIES[0]
@@ -337,6 +343,7 @@ async def test_flux_after_sunset_before_stop(hass):
assert await async_setup_component(
hass, light.DOMAIN, {light.DOMAIN: {CONF_PLATFORM: "test"}}
)
await hass.async_block_till_done()
ent1 = platform.ENTITIES[0]
@@ -391,6 +398,7 @@ async def test_flux_after_stop_before_sunrise(hass):
assert await async_setup_component(
hass, light.DOMAIN, {light.DOMAIN: {CONF_PLATFORM: "test"}}
)
await hass.async_block_till_done()
ent1 = platform.ENTITIES[0]
@@ -444,6 +452,7 @@ async def test_flux_with_custom_start_stop_times(hass):
assert await async_setup_component(
hass, light.DOMAIN, {light.DOMAIN: {CONF_PLATFORM: "test"}}
)
await hass.async_block_till_done()
ent1 = platform.ENTITIES[0]
@@ -501,6 +510,7 @@ async def test_flux_before_sunrise_stop_next_day(hass):
assert await async_setup_component(
hass, light.DOMAIN, {light.DOMAIN: {CONF_PLATFORM: "test"}}
)
await hass.async_block_till_done()
ent1 = platform.ENTITIES[0]
@@ -559,6 +569,7 @@ async def test_flux_after_sunrise_before_sunset_stop_next_day(hass):
assert await async_setup_component(
hass, light.DOMAIN, {light.DOMAIN: {CONF_PLATFORM: "test"}}
)
await hass.async_block_till_done()
ent1 = platform.ENTITIES[0]
@@ -617,6 +628,7 @@ async def test_flux_after_sunset_before_midnight_stop_next_day(hass, x):
assert await async_setup_component(
hass, light.DOMAIN, {light.DOMAIN: {CONF_PLATFORM: "test"}}
)
await hass.async_block_till_done()
ent1 = platform.ENTITIES[0]
@@ -674,6 +686,7 @@ async def test_flux_after_sunset_after_midnight_stop_next_day(hass):
assert await async_setup_component(
hass, light.DOMAIN, {light.DOMAIN: {CONF_PLATFORM: "test"}}
)
await hass.async_block_till_done()
ent1 = platform.ENTITIES[0]
@@ -731,6 +744,7 @@ async def test_flux_after_stop_before_sunrise_stop_next_day(hass):
assert await async_setup_component(
hass, light.DOMAIN, {light.DOMAIN: {CONF_PLATFORM: "test"}}
)
await hass.async_block_till_done()
ent1 = platform.ENTITIES[0]
@@ -785,6 +799,7 @@ async def test_flux_with_custom_colortemps(hass):
assert await async_setup_component(
hass, light.DOMAIN, {light.DOMAIN: {CONF_PLATFORM: "test"}}
)
await hass.async_block_till_done()
ent1 = platform.ENTITIES[0]
@@ -841,6 +856,7 @@ async def test_flux_with_custom_brightness(hass):
assert await async_setup_component(
hass, light.DOMAIN, {light.DOMAIN: {CONF_PLATFORM: "test"}}
)
await hass.async_block_till_done()
ent1 = platform.ENTITIES[0]
@@ -895,6 +911,7 @@ async def test_flux_with_multiple_lights(hass):
assert await async_setup_component(
hass, light.DOMAIN, {light.DOMAIN: {CONF_PLATFORM: "test"}}
)
await hass.async_block_till_done()
ent1, ent2, ent3 = platform.ENTITIES
@@ -972,6 +989,7 @@ async def test_flux_with_mired(hass):
assert await async_setup_component(
hass, light.DOMAIN, {light.DOMAIN: {CONF_PLATFORM: "test"}}
)
await hass.async_block_till_done()
ent1 = platform.ENTITIES[0]
@@ -1023,6 +1041,7 @@ async def test_flux_with_rgb(hass):
assert await async_setup_component(
hass, light.DOMAIN, {light.DOMAIN: {CONF_PLATFORM: "test"}}
)
await hass.async_block_till_done()
ent1 = platform.ENTITIES[0]