diff --git a/tests/test_switch.py b/tests/test_switch.py index e4082bb4..4744f878 100644 --- a/tests/test_switch.py +++ b/tests/test_switch.py @@ -590,7 +590,6 @@ async def test_manual_control( async def update(): await switch._update_attrs_and_maybe_adapt_lights(context=context, transition=0) - await asyncio.gather(*switch.manager.adaptation_tasks) await hass.async_block_till_done() async def turn_light(state, **kwargs): @@ -766,23 +765,17 @@ async def test_auto_reset_manual_control(hass): manual_control = switch.manager.manual_control async def update(): - _LOGGER.debug("start update") await switch._update_attrs_and_maybe_adapt_lights(context=context, transition=0) - _LOGGER.debug("end update") await hass.async_block_till_done() - _LOGGER.debug("end block in update ") async def turn_light(state, **kwargs): - _LOGGER.debug("start turn light") await hass.services.async_call( LIGHT_DOMAIN, SERVICE_TURN_ON if state else SERVICE_TURN_OFF, {ATTR_ENTITY_ID: light.entity_id, **kwargs}, blocking=True, ) - _LOGGER.debug("end turn light") await hass.async_block_till_done() - _LOGGER.debug("end block in turn light") await update() _LOGGER.debug( "Turn light %s to state %s, to %s", light.entity_id, state, kwargs @@ -806,15 +799,12 @@ async def test_auto_reset_manual_control(hass): for i in range(3): _LOGGER.debug("Quick change %s", i) await turn_light(True, brightness=(i + 1) * 20) - _LOGGER.debug("yolo 1") - await asyncio.sleep(0.04) # Less than 0.1, but 3x0.04 > 0.1 - _LOGGER.debug("yolo 2") + await asyncio.sleep(0.05) # Less than 0.1 assert manual_control[light.entity_id] await update() await asyncio.sleep(0.3) # Wait the auto reset time assert not manual_control[light.entity_id] - assert 0, switch.extra_state_attributes["autoreset_time_remaining"] async def test_apply_service(hass):