(check_func, expected, actual, timeout=10.0, interval=0.1)
| 30 | |
| 31 | |
| 32 | async def assert_with_timeout(check_func, expected, actual, timeout=10.0, interval=0.1): |
| 33 | end_time = asyncio.get_event_loop().time() + timeout |
| 34 | while True: |
| 35 | if check_func(): |
| 36 | return |
| 37 | if asyncio.get_event_loop().time() > end_time: |
| 38 | func_src = inspect.getsource(check_func).strip() |
| 39 | assert False, ( |
| 40 | f"Timeout reached before condition in `{func_src}` became true. Expected: {expected}, Actual: {actual}" |
| 41 | ) |
| 42 | await asyncio.sleep(interval) |
| 43 | |
| 44 | |
| 45 | async def assert_current_result_is_selected_for_save(p: Pilot): |
no outgoing calls