diff options
Diffstat (limited to 'tests/tests_asyncio.py')
-rw-r--r-- | tests/tests_asyncio.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/tests/tests_asyncio.py b/tests/tests_asyncio.py index bdef569..250e658 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 |