Skip to content

Commit 9e75283

Browse files
committed
Avoid Python 3.13+ RuntimeWarning: coroutine method 'aclose' of 'acount' was never awaited
See python/cpython#117536 (comment)
1 parent eafdd30 commit 9e75283

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

tests/tests_asyncio.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,14 @@ async def test_generators(capsys):
4848
_, err = capsys.readouterr()
4949
assert '9it' in err
5050

51-
with tqdm(acount(), desc="async_counter") as pbar:
52-
async for i in pbar:
53-
if i >= 8:
54-
break
51+
acounter = acount()
52+
try:
53+
with tqdm(acounter, desc="async_counter") as pbar:
54+
async for i in pbar:
55+
if i >= 8:
56+
break
57+
finally:
58+
await acounter.aclose()
5559
_, err = capsys.readouterr()
5660
assert '9it' in err
5761

0 commit comments

Comments
 (0)