From 2fbad6ad511e551efe868e70f61c876e0c467fd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Mon, 8 Jul 2024 17:26:13 +0200 Subject: [PATCH] Avoid Python 3.13+ RuntimeWarning: coroutine method 'aclose' of 'acount' was never awaited See https://github.com/python/cpython/issues/117536#issuecomment-2036883124 --- tests/tests_asyncio.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/tests_asyncio.py b/tests/tests_asyncio.py index bdef569f..250e6585 100644 --- a/tests/tests_asyncio.py +++ b/tests/tests_asyncio.py @@ -48,10 +48,14 @@ async def test_generators(capsys): _, err = capsys.readouterr() assert '9it' in err - with tqdm(acount(), desc="async_counter") as pbar: - async for i in pbar: - if i >= 8: - break + acounter = acount() + try: + with tqdm(acounter, desc="async_counter") as pbar: + async for i in pbar: + if i >= 8: + break + finally: + await acounter.aclose() _, err = capsys.readouterr() assert '9it' in err