From: Thomas Grainger Date: Tue, 25 Mar 2025 08:29:51 +0000 (+0000) Subject: gh-131707: fix unawaited coroutine warning in test_coroutines.Corouti… (#131708) X-Git-Tag: v3.14.0a7~198 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6fb5f7f4d9d22c49f5c29d2ffcbcc32b6cd7d06a;p=thirdparty%2FPython%2Fcpython.git gh-131707: fix unawaited coroutine warning in test_coroutines.Corouti… (#131708) gh-131707: fix unawaited coroutine warning in test_coroutines.CoroutineTest.test_17 --- diff --git a/Lib/test/test_coroutines.py b/Lib/test/test_coroutines.py index d78eaaca2796..deeaa724e795 100644 --- a/Lib/test/test_coroutines.py +++ b/Lib/test/test_coroutines.py @@ -1199,8 +1199,8 @@ class CoroutineTest(unittest.TestCase): def __aiter__(self): return self - anext_awaitable = anext(A(), "a").__await__() - self.assertRaises(TypeError, anext_awaitable.close, 1) + with contextlib.closing(anext(A(), "a").__await__()) as anext_awaitable: + self.assertRaises(TypeError, anext_awaitable.close, 1) def test_with_1(self): class Manager: