Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
gh-110378: Fix test_async_gen_propagates_generator_exit in test_conte…
…xtlib_async (GH-110500)

It now fails if the original bug is not fixed, and no longer produce ResourceWarning with fixed code.
(cherry picked from commit 5aa62a8)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
  • Loading branch information
serhiy-storchaka authored and miss-islington committed Oct 10, 2023
commit dd2e259357f10842e7dc47c3b7672f1d81900f9c
14 changes: 5 additions & 9 deletions Lib/test/test_contextlib_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,11 @@ async def gen():
async with ctx():
yield 11

ret = []
exc = ValueError(22)
with self.assertRaises(ValueError):
async with ctx():
async for val in gen():
ret.append(val)
raise exc

self.assertEqual(ret, [11])
g = gen()
async for val in g:
self.assertEqual(val, 11)
break
await g.aclose()

def test_exit_is_abstract(self):
class MissingAexit(AbstractAsyncContextManager):
Expand Down