From 44f1b987ed1908185d8021fd31703b2dd4d97e82 Mon Sep 17 00:00:00 2001 From: Stan Ulbrych Date: Tue, 14 Apr 2026 07:45:26 +0100 Subject: [PATCH 1/2] gh-148487: Fix issues in `test_add_python_opts` (#148507) --- Lib/test/test_regrtest.py | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/Lib/test/test_regrtest.py b/Lib/test/test_regrtest.py index 0946289328ccda..02f6e0c74b5ce8 100644 --- a/Lib/test/test_regrtest.py +++ b/Lib/test/test_regrtest.py @@ -2230,10 +2230,7 @@ def test_unload_tests(self): self.check_executed_tests(output, tests, stats=3) def check_add_python_opts(self, option): - # --fast-ci and --slow-ci add "-u -W default -bb -E" options to Python - - # Skip test if _testinternalcapi is missing - import_helper.import_module('_testinternalcapi') + # --fast-ci and --slow-ci add "-u -W error -bb -E" options to Python code = textwrap.dedent(r""" import sys @@ -2248,25 +2245,26 @@ def check_add_python_opts(self, option): use_environment = (support.is_emscripten or support.is_wasi) class WorkerTests(unittest.TestCase): - @unittest.skipUnless(config_get is None, 'need config_get()') + @unittest.skipIf(config_get is None, 'need config_get()') def test_config(self): - config = config_get() # -u option self.assertEqual(config_get('buffered_stdio'), 0) - # -W default option - self.assertTrue(config_get('warnoptions'), ['default']) + # -W error option + self.assertEqual(config_get('warnoptions'), + ['error', 'error::BytesWarning']) # -bb option - self.assertTrue(config_get('bytes_warning'), 2) + self.assertEqual(config_get('bytes_warning'), 2) # -E option - self.assertTrue(config_get('use_environment'), use_environment) + self.assertEqual(config_get('use_environment'), use_environment) def test_python_opts(self): # -u option self.assertTrue(sys.__stdout__.write_through) self.assertTrue(sys.__stderr__.write_through) - # -W default option - self.assertTrue(sys.warnoptions, ['default']) + # -W error option + self.assertEqual(sys.warnoptions, + ['error', 'error::BytesWarning']) # -bb option self.assertEqual(sys.flags.bytes_warning, 2) From 21da9d7164ef6b3695b45b2f648b031ef49c93c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartosz=20S=C5=82awecki?= Date: Tue, 14 Apr 2026 11:29:01 +0200 Subject: [PATCH 2/2] gh-143955: Prevent schema drift false-positives in asyncio tools tests (#148525) --- Lib/test/test_asyncio/test_tools.py | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/Lib/test/test_asyncio/test_tools.py b/Lib/test/test_asyncio/test_tools.py index 1ab51a6ca3e49b..df934164eb9fd6 100644 --- a/Lib/test/test_asyncio/test_tools.py +++ b/Lib/test/test_asyncio/test_tools.py @@ -2,13 +2,27 @@ from asyncio import tools -from collections import namedtuple +import _remote_debugging -LocationInfo = namedtuple('LocationInfo', ['lineno', 'end_lineno', 'col_offset', 'end_col_offset'], defaults=[None]*4) -FrameInfo = namedtuple('FrameInfo', ['funcname', 'filename', 'location']) -CoroInfo = namedtuple('CoroInfo', ['call_stack', 'task_name']) -TaskInfo = namedtuple('TaskInfo', ['task_id', 'task_name', 'coroutine_stack', 'awaited_by']) -AwaitedInfo = namedtuple('AwaitedInfo', ['thread_id', 'awaited_by']) + +def LocationInfo(lineno, end_lineno=None, col_offset=None, end_col_offset=None): + return _remote_debugging.LocationInfo((lineno, end_lineno, col_offset, end_col_offset)) + + +def FrameInfo(funcname, filename, location, opcode=None): + return _remote_debugging.FrameInfo((filename, location, funcname, opcode)) + + +def CoroInfo(call_stack, task_name): + return _remote_debugging.CoroInfo((call_stack, task_name)) + + +def TaskInfo(task_id, task_name, coroutine_stack, awaited_by): + return _remote_debugging.TaskInfo((task_id, task_name, coroutine_stack, awaited_by)) + + +def AwaitedInfo(thread_id, awaited_by): + return _remote_debugging.AwaitedInfo((thread_id, awaited_by)) # mock output of get_all_awaited_by function.