summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2023-10-10 09:38:40 (GMT)
committerGitHub <noreply@github.com>2023-10-10 09:38:40 (GMT)
commit5aa62a8de15212577a13966710b3aede46e93824 (patch)
tree4e8296c3e119ab6b17c1b568ec1e88e98c02036c
parentfc811c8d205db9c19f42890e2c4193a0c2f87965 (diff)
downloadcpython-5aa62a8de15212577a13966710b3aede46e93824.zip
cpython-5aa62a8de15212577a13966710b3aede46e93824.tar.gz
cpython-5aa62a8de15212577a13966710b3aede46e93824.tar.bz2
gh-110378: Fix test_async_gen_propagates_generator_exit in test_contextlib_async (#110500)
It now fails if the original bug is not fixed, and no longer produce ResourceWarning with fixed code.
-rw-r--r--Lib/test/test_contextlib_async.py14
1 files changed, 5 insertions, 9 deletions
diff --git a/Lib/test/test_contextlib_async.py b/Lib/test/test_contextlib_async.py
index 540964a..ca73157 100644
--- a/Lib/test/test_contextlib_async.py
+++ b/Lib/test/test_contextlib_async.py
@@ -49,15 +49,11 @@ class TestAbstractAsyncContextManager(unittest.IsolatedAsyncioTestCase):
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):