Skip to content

Commit

Permalink
revert tests
Browse files Browse the repository at this point in the history
  • Loading branch information
basnijholt committed Aug 10, 2023
1 parent 6ef8d41 commit 98390a5
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions tests/test_switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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
Expand All @@ -806,15 +799,12 @@ async def turn_light(state, **kwargs):
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):
Expand Down

0 comments on commit 98390a5

Please sign in to comment.