Skip to content

Commit

Permalink
pythongh-110378: Fix test_async_gen_propagates_generator_exit in test…
Browse files Browse the repository at this point in the history
…_contextlib_async (python#110500)

It now fails if the original bug is not fixed, and no longer produce ResourceWarning with fixed code.
  • Loading branch information
serhiy-storchaka authored Oct 10, 2023
1 parent fc811c8 commit 5aa62a8
Showing 1 changed file with 5 additions and 9 deletions.
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

0 comments on commit 5aa62a8

Please sign in to comment.