Mark executor jobs as background unless created from a tracked task (#114450)
* Mark executor jobs as background unless created from a tracked task If the current task is not tracked the executor job should not be a background task to avoid delaying startup and shutdown. Currently any executor job created in a untracked task or background task would end up being tracked and delaying startup/shutdown * import exec has the same issue * Avoid tracking import executor jobs There is no reason to track these jobs as they are always awaited and we do not want to support fire and forget import executor jobs * fix xiaomi_miio * lots of fire time changed without background await * revert changes moved to other PR * more * more * more * m * m * p * fix fire and forget tests * scrape * sonos * system * more * capture callback before block * coverage * more * more races * more races * more * missed some * more fixes * missed some more * fix * remove unneeded * one more race * two
This commit is contained in:
parent
aec7a67a58
commit
9a79320861
46 changed files with 246 additions and 180 deletions
|
@ -140,7 +140,7 @@ async def test_thermostat_set_hvac_mode_off(
|
|||
thermostat.valve_position = 0
|
||||
|
||||
async_fire_time_changed(hass, utcnow() + timedelta(minutes=5))
|
||||
await hass.async_block_till_done()
|
||||
await hass.async_block_till_done(wait_background_tasks=True)
|
||||
|
||||
state = hass.states.get(ENTITY_ID)
|
||||
assert state.state == HVACMode.OFF
|
||||
|
@ -168,8 +168,8 @@ async def test_thermostat_set_hvac_mode_heat(
|
|||
thermostat.mode = MAX_DEVICE_MODE_MANUAL
|
||||
|
||||
async_fire_time_changed(hass, utcnow() + timedelta(minutes=5))
|
||||
await hass.async_block_till_done()
|
||||
await hass.async_block_till_done()
|
||||
await hass.async_block_till_done(wait_background_tasks=True)
|
||||
await hass.async_block_till_done(wait_background_tasks=True)
|
||||
|
||||
state = hass.states.get(ENTITY_ID)
|
||||
assert state.state == HVACMode.HEAT
|
||||
|
@ -204,7 +204,7 @@ async def test_thermostat_set_temperature(
|
|||
thermostat.valve_position = 0
|
||||
|
||||
async_fire_time_changed(hass, utcnow() + timedelta(minutes=5))
|
||||
await hass.async_block_till_done()
|
||||
await hass.async_block_till_done(wait_background_tasks=True)
|
||||
|
||||
state = hass.states.get(ENTITY_ID)
|
||||
assert state.state == HVACMode.AUTO
|
||||
|
@ -248,7 +248,7 @@ async def test_thermostat_set_preset_on(
|
|||
thermostat.target_temperature = ON_TEMPERATURE
|
||||
|
||||
async_fire_time_changed(hass, utcnow() + timedelta(minutes=5))
|
||||
await hass.async_block_till_done()
|
||||
await hass.async_block_till_done(wait_background_tasks=True)
|
||||
|
||||
state = hass.states.get(ENTITY_ID)
|
||||
assert state.state == HVACMode.HEAT
|
||||
|
@ -273,7 +273,7 @@ async def test_thermostat_set_preset_comfort(
|
|||
thermostat.target_temperature = thermostat.comfort_temperature
|
||||
|
||||
async_fire_time_changed(hass, utcnow() + timedelta(minutes=5))
|
||||
await hass.async_block_till_done()
|
||||
await hass.async_block_till_done(wait_background_tasks=True)
|
||||
|
||||
state = hass.states.get(ENTITY_ID)
|
||||
assert state.state == HVACMode.HEAT
|
||||
|
@ -298,7 +298,7 @@ async def test_thermostat_set_preset_eco(
|
|||
thermostat.target_temperature = thermostat.eco_temperature
|
||||
|
||||
async_fire_time_changed(hass, utcnow() + timedelta(minutes=5))
|
||||
await hass.async_block_till_done()
|
||||
await hass.async_block_till_done(wait_background_tasks=True)
|
||||
|
||||
state = hass.states.get(ENTITY_ID)
|
||||
assert state.state == HVACMode.HEAT
|
||||
|
@ -323,7 +323,7 @@ async def test_thermostat_set_preset_away(
|
|||
thermostat.target_temperature = thermostat.eco_temperature
|
||||
|
||||
async_fire_time_changed(hass, utcnow() + timedelta(minutes=5))
|
||||
await hass.async_block_till_done()
|
||||
await hass.async_block_till_done(wait_background_tasks=True)
|
||||
|
||||
state = hass.states.get(ENTITY_ID)
|
||||
assert state.state == HVACMode.HEAT
|
||||
|
@ -348,7 +348,7 @@ async def test_thermostat_set_preset_boost(
|
|||
thermostat.target_temperature = thermostat.eco_temperature
|
||||
|
||||
async_fire_time_changed(hass, utcnow() + timedelta(minutes=5))
|
||||
await hass.async_block_till_done()
|
||||
await hass.async_block_till_done(wait_background_tasks=True)
|
||||
|
||||
state = hass.states.get(ENTITY_ID)
|
||||
assert state.state == HVACMode.AUTO
|
||||
|
@ -401,7 +401,7 @@ async def test_wallthermostat_set_hvac_mode_heat(
|
|||
wallthermostat.target_temperature = MIN_TEMPERATURE
|
||||
|
||||
async_fire_time_changed(hass, utcnow() + timedelta(minutes=5))
|
||||
await hass.async_block_till_done()
|
||||
await hass.async_block_till_done(wait_background_tasks=True)
|
||||
|
||||
state = hass.states.get(WALL_ENTITY_ID)
|
||||
assert state.state == HVACMode.HEAT
|
||||
|
@ -425,7 +425,7 @@ async def test_wallthermostat_set_hvac_mode_auto(
|
|||
wallthermostat.target_temperature = 23.0
|
||||
|
||||
async_fire_time_changed(hass, utcnow() + timedelta(minutes=5))
|
||||
await hass.async_block_till_done()
|
||||
await hass.async_block_till_done(wait_background_tasks=True)
|
||||
|
||||
state = hass.states.get(WALL_ENTITY_ID)
|
||||
assert state.state == HVACMode.AUTO
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue