cpython/Lib/test/test_io
Cody Maloney 6dd21e9f56
gh-138013: Remove test_io load_tests namespace manipulation (#138366)
Reduce what happens in `load_tests` so that the next change,
moving the `Buffered*` tests to `test_bufferdio` is purely mechanical
movement and updating imports.

This adds two classes, one per I/O implementation, to act as dispatch to
the implementation-specific mocks as well as module members. Previously
the mappings CTestCase and PyTestCase provide were injected directly
during `load_tests`.

CTestCase and PyTestCase inherit from `unittest.TestCase` so when the
split happens default test discovery will work for the classes in
`test_bufferedio`. `test_general` keeps a manual test list for this
refactoring; some of the tests (ex. `ProtocolsTest`) aren't currently
run and fixing that + helpers to not be picked up is out of my current
scope.

CTestCase and PyTestCase have an `io` class member which points to the
implementation meaning that can be removed from individual test cases
which now inherit from them.

This code is picking up `MockRawIO` which is defined globally in the
module but these should use the mock specific to the I/O implementation
being tested.

Co-authored-by: Victor Stinner <vstinner@python.org>
2025-09-03 11:49:59 +02:00
..
__init__.py gh-138013: Move I/O tests to test_io (#138365) 2025-09-03 11:37:06 +02:00
__main__.py
test_bufferedio.py gh-138013: Move I/O tests to test_io (#138365) 2025-09-03 11:37:06 +02:00
test_file.py gh-138013: Move I/O tests to test_io (#138365) 2025-09-03 11:37:06 +02:00
test_fileio.py gh-138013: Move I/O tests to test_io (#138365) 2025-09-03 11:37:06 +02:00
test_general.py gh-138013: Remove test_io load_tests namespace manipulation (#138366) 2025-09-03 11:49:59 +02:00
test_largefile.py gh-138013: Move I/O tests to test_io (#138365) 2025-09-03 11:37:06 +02:00
test_memoryio.py gh-138013: Move I/O tests to test_io (#138365) 2025-09-03 11:37:06 +02:00
test_univnewlines.py gh-138013: Move I/O tests to test_io (#138365) 2025-09-03 11:37:06 +02:00