summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_contextlib_async.py
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2023-10-10 11:12:30 (GMT)
committerGitHub <noreply@github.com>2023-10-10 11:12:30 (GMT)
commit26a3563caeed5dd77c8ef9c0dc4e0cc1edc064c4 (patch)
treed4a6b1a647a868b2d71fbda1e23115a2638320b9 /Lib/test/test_contextlib_async.py
parentc1e8e90915e38604175e20e36a24fe45249cdc33 (diff)
downloadcpython-26a3563caeed5dd77c8ef9c0dc4e0cc1edc064c4.zip
cpython-26a3563caeed5dd77c8ef9c0dc4e0cc1edc064c4.tar.gz
cpython-26a3563caeed5dd77c8ef9c0dc4e0cc1edc064c4.tar.bz2
[3.12] gh-110378: Fix test_async_gen_propagates_generator_exit in test_contextlib_async (GH-110500) (#110610)
It now fails if the original bug is not fixed, and no longer produce ResourceWarning with fixed code. (cherry picked from commit 5aa62a8de15212577a13966710b3aede46e93824) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Diffstat (limited to 'Lib/test/test_contextlib_async.py')
-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 e519dff..02d3fe7 100644
--- a/Lib/test/test_contextlib_async.py
+++ b/Lib/test/test_contextlib_async.py
@@ -49,15 +49,11 @@ class TestAbstractAsyncContextManager(unittest.TestCase):
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):