(
actual_cb: Callable[[], Union[Any, Awaitable[Any]]], expected: Any
)
| 22 | |
| 23 | |
| 24 | async def assert_equal( |
| 25 | actual_cb: Callable[[], Union[Any, Awaitable[Any]]], expected: Any |
| 26 | ) -> None: |
| 27 | __tracebackhide__ = True |
| 28 | start_time = asyncio.get_event_loop().time() |
| 29 | attempts = 0 |
| 30 | while True: |
| 31 | actual = actual_cb() |
| 32 | if asyncio.iscoroutine(actual): |
| 33 | actual = await actual |
| 34 | if actual == expected: |
| 35 | return |
| 36 | attempts += 1 |
| 37 | if asyncio.get_event_loop().time() - start_time > 5: |
| 38 | raise TimeoutError(f"Timed out after 10 seconds. Last actual was: {actual}") |
| 39 | await asyncio.sleep(0.2) |
| 40 | |
| 41 | |
| 42 | async def setup_ws( |
no test coverage detected