From 90c8790c59aea090ef8fcd5ff5a608bdc2f98591 Mon Sep 17 00:00:00 2001 From: Thomas Grainger Date: Fri, 3 Jan 2025 07:16:33 +0000 Subject: [PATCH 1/2] gh-128404: remove asyncio from test_sys_settrace --- Lib/test/test_sys_settrace.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/Lib/test/test_sys_settrace.py b/Lib/test/test_sys_settrace.py index e5cf88177f7131..df3e21f673f61d 100644 --- a/Lib/test/test_sys_settrace.py +++ b/Lib/test/test_sys_settrace.py @@ -6,8 +6,7 @@ import difflib import gc from functools import wraps -import asyncio -from test.support import import_helper, requires_subprocess +from test.support import import_helper, requires_subprocess, run_no_yield_async_fn import contextlib import os import tempfile @@ -19,8 +18,6 @@ except ImportError: _testinternalcapi = None -support.requires_working_socket(module=True) - class tracecontext: """Context manager that traces its enter and exit.""" def __init__(self, output, value): @@ -2067,10 +2064,10 @@ def run_async_test(self, func, jumpFrom, jumpTo, expected, error=None, stack.enter_context(self.assertRaisesRegex(*error)) if warning is not None: stack.enter_context(self.assertWarnsRegex(*warning)) - asyncio.run(func(output)) + + run_no_yield_async_fn(func, output) sys.settrace(None) - asyncio._set_event_loop_policy(None) self.compare_jump_output(expected, output) def jump_test(jumpFrom, jumpTo, expected, error=None, event='line', warning=None): From 1c14b768bce75d23e8d517283bd43945ebbc4744 Mon Sep 17 00:00:00 2001 From: Thomas Grainger Date: Fri, 3 Jan 2025 07:44:39 +0000 Subject: [PATCH 2/2] Update Lib/test/test_sys_settrace.py --- Lib/test/test_sys_settrace.py | 1 - 1 file changed, 1 deletion(-) diff --git a/Lib/test/test_sys_settrace.py b/Lib/test/test_sys_settrace.py index df3e21f673f61d..28c2c681babe18 100644 --- a/Lib/test/test_sys_settrace.py +++ b/Lib/test/test_sys_settrace.py @@ -2064,7 +2064,6 @@ def run_async_test(self, func, jumpFrom, jumpTo, expected, error=None, stack.enter_context(self.assertRaisesRegex(*error)) if warning is not None: stack.enter_context(self.assertWarnsRegex(*warning)) - run_no_yield_async_fn(func, output) sys.settrace(None)