mirror of
https://github.com/esphome/esphome.git
synced 2025-08-01 07:57:47 +00:00
cover
This commit is contained in:
parent
7b4edf77da
commit
d4a488f9d2
@ -33,7 +33,7 @@ script:
|
||||
- logger.log:
|
||||
format: "Script execution started (run number %d)"
|
||||
args: ['id(delay_completed_count) + 1']
|
||||
- delay: 3s
|
||||
- delay: 150ms
|
||||
- lambda: |-
|
||||
id(delay_completed_count)++;
|
||||
- logger.log:
|
||||
|
@ -92,17 +92,16 @@ async def test_delay_action_cancellation(
|
||||
await asyncio.wait_for(script_started_future, timeout=5.0)
|
||||
assert script_started_count == 1, "Script should have started once"
|
||||
|
||||
# Wait a bit to ensure the delay is running
|
||||
await asyncio.sleep(0.5)
|
||||
# Restart immediately - no sleep needed since we're properly testing cancellation
|
||||
|
||||
# Restart the script
|
||||
client.execute_service(restart_service, {})
|
||||
|
||||
# Wait for restart confirmation
|
||||
await asyncio.wait_for(script_restarted_future, timeout=5.0)
|
||||
await asyncio.wait_for(script_restarted_future, timeout=2.0)
|
||||
|
||||
# Wait for the restarted script to complete its delay
|
||||
await asyncio.wait_for(delay_completed_future, timeout=5.0)
|
||||
await asyncio.wait_for(delay_completed_future, timeout=1.0)
|
||||
|
||||
# Check the final result
|
||||
client.execute_service(check_result_service, {})
|
||||
|
Loading…
x
Reference in New Issue
Block a user