Build 060.26: complete Integration and Regression
This commit is contained in:
18
app/tests/support/async_wait.py
Normal file
18
app/tests/support/async_wait.py
Normal file
@@ -0,0 +1,18 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from collections.abc import Callable
|
||||
|
||||
|
||||
Predicate = Callable[[], bool]
|
||||
|
||||
|
||||
async def wait_until(
|
||||
predicate: Predicate,
|
||||
*,
|
||||
timeout_seconds: float = 3.0,
|
||||
) -> None:
|
||||
"""Дождаться наблюдаемого условия без фиксированной длинной паузы."""
|
||||
async with asyncio.timeout(timeout_seconds):
|
||||
while not predicate():
|
||||
await asyncio.sleep(0.005)
|
||||
Reference in New Issue
Block a user