From a29db8aa757a61be257887a12f0ab1f66a893365 Mon Sep 17 00:00:00 2001 From: Cody Maloney Date: Thu, 5 Nov 2026 21:17:15 -0800 Subject: [PATCH 1/6] gh-161458: Move test_file_eintr into test_io Co-Authored-By: Claude Opus 5.5 --- Lib/test/{ => test_io}/test_file_eintr.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Lib/test/{ => test_io}/test_file_eintr.py (100%) diff --git a/Lib/test/test_file_eintr.py b/Lib/test/test_io/test_file_eintr.py similarity index 100% rename from Lib/test/test_file_eintr.py rename to Lib/test/test_io/test_file_eintr.py From f98464f16d09ad95a181dd6e8c8538e7442e6844 Mon Sep 17 00:00:00 2001 From: Cody Maloney Date: Thu, 5 Nov 2026 21:17:15 -0800 Subject: [PATCH 2/6] gh-161458: Move test_winconsoleio into test_io Co-Authored-By: Claude Opus 5.5 --- Lib/test/{ => test_io}/test_winconsoleio.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Lib/test/{ => test_io}/test_winconsoleio.py (100%) diff --git a/Lib/test/test_winconsoleio.py b/Lib/test/test_io/test_winconsoleio.py similarity index 100% rename from Lib/test/test_winconsoleio.py rename to Lib/test/test_io/test_winconsoleio.py From c5fc99b896b0da29551f4e57b3059d2214098404 Mon Sep 17 00:00:00 2001 From: Cody Maloney Date: Thu, 5 Nov 2026 21:17:15 -0800 Subject: [PATCH 3/6] gh-161458: Move test_free_threading/test_io into test_io as test_free_threading Co-Authored-By: Claude Opus 5.5 --- .../test_io.py => test_io/test_free_threading.py} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Lib/test/{test_free_threading/test_io.py => test_io/test_free_threading.py} (100%) diff --git a/Lib/test/test_free_threading/test_io.py b/Lib/test/test_io/test_free_threading.py similarity index 100% rename from Lib/test/test_free_threading/test_io.py rename to Lib/test/test_io/test_free_threading.py From d95adb59dc654f8943b93d8bc3bcf87f4162e0b8 Mon Sep 17 00:00:00 2001 From: Cody Maloney Date: Thu, 5 Nov 2026 21:17:16 -0800 Subject: [PATCH 4/6] gh-161458: Skip test_io.test_free_threading on GIL builds The test_free_threading package skipped these on GIL builds. Co-Authored-By: Claude Opus 5.5 --- Lib/test/test_io/test_free_threading.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Lib/test/test_io/test_free_threading.py b/Lib/test/test_io/test_free_threading.py index a2b1ec8eb72bb1a..d4cbfe446d92285 100644 --- a/Lib/test/test_io/test_free_threading.py +++ b/Lib/test/test_io/test_free_threading.py @@ -2,12 +2,15 @@ import io import _pyio as pyio import threading -from unittest import TestCase -from test.support import threading_helper +from unittest import SkipTest, TestCase +from test.support import Py_GIL_DISABLED, threading_helper from test.support.threading_helper import run_concurrently from random import randint from sys import getsizeof +if not Py_GIL_DISABLED: + raise SkipTest("GIL enabled") + threading_helper.requires_working_threading(module=True) From 5d5992a3c87c25dbe32569ee7c48f143737a65c1 Mon Sep 17 00:00:00 2001 From: Cody Maloney Date: Thu, 5 Nov 2026 21:17:22 -0800 Subject: [PATCH 5/6] gh-161458: Remove the test module list from the test_io docstring It goes stale whenever a module is added or moved. Co-Authored-By: Claude Opus 5.5 --- Lib/test/test_io/__init__.py | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/Lib/test/test_io/__init__.py b/Lib/test/test_io/__init__.py index c94fad3e779381d..ab9f2c280d96810 100644 --- a/Lib/test/test_io/__init__.py +++ b/Lib/test/test_io/__init__.py @@ -3,17 +3,6 @@ Tests are split across multiple files to increase parallelism and focus on specific implementation pieces. -* test_io - * test_bufferedio - tests file buffering - * test_memoryio - tests BytesIO and StringIO - * test_fileio - tests FileIO - * test_file - tests the file interface - * test_general - tests everything else in the io module - * test_univnewlines - tests universal newline support - * test_largefile - tests operations on a file greater than 2**32 bytes - (only enabled with -ulargefile) -* test_free_threading/test_io - tests thread safety of io objects - .. attention:: When writing tests for io, it's important to test both the C and Python implementations. This is usually done by writing a base test that refers to From 03f4f2f40760e22473f792e8c577f7c66a82ee02 Mon Sep 17 00:00:00 2001 From: Cody Maloney Date: Thu, 5 Nov 2026 21:20:28 -0800 Subject: [PATCH 6/6] gh-161458: Point to I/O tests outside test_io in its docstring Co-Authored-By: Claude Opus 5.5 --- Lib/test/test_io/__init__.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Lib/test/test_io/__init__.py b/Lib/test/test_io/__init__.py index ab9f2c280d96810..ab735e1538185fa 100644 --- a/Lib/test/test_io/__init__.py +++ b/Lib/test/test_io/__init__.py @@ -3,6 +3,15 @@ Tests are split across multiple files to increase parallelism and focus on specific implementation pieces. +Tests for code that uses io live with that code, for example: + +* test_capi.test_file - the PyFile_* C API +* test_builtin, test_print - open(), input() and print() +* test_cmd_line, test_subprocess - stdio buffering and newlines at startup + and through pipes +* test_utf8_mode - UTF-8 mode encodings, including with _pyio +* test_os, test_eintr - fd-level I/O and EINTR retries + .. attention:: When writing tests for io, it's important to test both the C and Python implementations. This is usually done by writing a base test that refers to