-
Notifications
You must be signed in to change notification settings - Fork 5
Open
project-chip/connectedhomeip
#43397Description
Extendable test timeouts
It is hard to predict what test timeout to set in Software Update tests -- it depends on the image size. Implement a feedback mechanism in tests that prompts a user whether the timeout should be extended and extends the timeout.
reschedule method
One of the possible implementations is reschedule method and asynchronous context managers.
Example:
import asyncio
async def my_task():
try:
# Start with a 5-second timeout
async with asyncio.timeout(5) as delay:
print("Starting long task...")
await asyncio.sleep(3)
# Something happened! We need more time.
# Extend it by another 5 seconds from right now
new_deadline = asyncio.get_running_loop().time() + 5
delay.reschedule(new_deadline)
print("Timeout extended!")
await asyncio.sleep(4)
except TimeoutError:
print("Task timed out anyway!")
asyncio.run(my_task())
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
In Progress