Merge pull request #1595 from hroncok/py3.13-await-aclose

Avoid Python 3.13+ RuntimeWarning: coroutine method 'aclose' of 'acount' was never awaited
This commit is contained in:
Casper da Costa-Luis 2024-08-03 23:25:22 +01:00 committed by GitHub
commit 951a2ba8d8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 8 additions and 4 deletions

View File

@ -48,10 +48,14 @@ async def test_generators(capsys):
_, err = capsys.readouterr() _, err = capsys.readouterr()
assert '9it' in err assert '9it' in err
with tqdm(acount(), desc="async_counter") as pbar: acounter = acount()
async for i in pbar: try:
if i >= 8: with tqdm(acounter, desc="async_counter") as pbar:
break async for i in pbar:
if i >= 8:
break
finally:
await acounter.aclose()
_, err = capsys.readouterr() _, err = capsys.readouterr()
assert '9it' in err assert '9it' in err