From 6fb5f7f4d9d22c49f5c29d2ffcbcc32b6cd7d06a Mon Sep 17 00:00:00 2001 From: Thomas Grainger Date: Tue, 25 Mar 2025 08:29:51 +0000 Subject: [PATCH] =?UTF-8?q?gh-131707:=20fix=20unawaited=20coroutine=20warn?= =?UTF-8?q?ing=20in=20test=5Fcoroutines.Corouti=E2=80=A6=20(#131708)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit gh-131707: fix unawaited coroutine warning in test_coroutines.CoroutineTest.test_17 --- Lib/test/test_coroutines.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Lib/test/test_coroutines.py b/Lib/test/test_coroutines.py index d78eaaca279..deeaa724e79 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: