Skip to content

Commit 32f7c7c

Browse files
committed
test: make maybe_await public for reuse
1 parent a7f4aaa commit 32f7c7c

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

‎tests/_utils.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
T = TypeVar('T')
1414

1515

16-
async def _maybe_await(value: Awaitable[T] | T) -> T:
16+
async def maybe_await(value: Awaitable[T] | T) -> T:
1717
"""Await `value` if it is awaitable, otherwise return it unchanged.
1818
1919
Lets `poll_until_condition` accept both sync and async callables.
@@ -62,14 +62,14 @@ async def poll_until_condition(
6262
"""
6363
deadline = time.monotonic() + timeout
6464
delay = poll_interval
65-
result = await _maybe_await(fn())
65+
result = await maybe_await(fn())
6666
while not condition(result):
6767
remaining = deadline - time.monotonic()
6868
if remaining <= 0:
6969
break
7070
await asyncio.sleep(min(delay, remaining))
7171
delay *= backoff_factor
72-
result = await _maybe_await(fn())
72+
result = await maybe_await(fn())
7373
return result
7474

7575

0 commit comments

Comments
 (0)