]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-128404: remove asyncio from test_type_params (#128436)
authorThomas Grainger <tagrain@gmail.com>
Fri, 3 Jan 2025 07:50:24 +0000 (07:50 +0000)
committerGitHub <noreply@github.com>
Fri, 3 Jan 2025 07:50:24 +0000 (07:50 +0000)
Lib/test/test_type_params.py

index 89f836cf722966bfd87369af7c493e76bbb596c2..0f393def8272713b82a963665a912dbdb1ab7afb 100644 (file)
@@ -1,11 +1,10 @@
 import annotationlib
-import asyncio
 import textwrap
 import types
 import unittest
 import pickle
 import weakref
-from test.support import requires_working_socket, check_syntax_error, run_code
+from test.support import check_syntax_error, run_code, run_no_yield_async_fn
 
 from typing import Generic, NoDefault, Sequence, TypeAliasType, TypeVar, TypeVarTuple, ParamSpec, get_args
 
@@ -1051,7 +1050,6 @@ class TypeParamsTypeVarTest(unittest.TestCase):
         self.assertIsInstance(c, TypeVar)
         self.assertEqual(c.__name__, "C")
 
-    @requires_working_socket()
     def test_typevar_coroutine(self):
         def get_coroutine[A]():
             async def coroutine[B]():
@@ -1060,8 +1058,7 @@ class TypeParamsTypeVarTest(unittest.TestCase):
 
         co = get_coroutine()
 
-        self.addCleanup(asyncio._set_event_loop_policy, None)
-        a, b = asyncio.run(co())
+        a, b = run_no_yield_async_fn(co)
 
         self.assertIsInstance(a, TypeVar)
         self.assertEqual(a.__name__, "A")