gh-138013: Remove test_io load_tests namespace manipulation#138366
Merged
vstinner merged 3 commits intopython:mainfrom Sep 3, 2025
Merged
gh-138013: Remove test_io load_tests namespace manipulation#138366vstinner merged 3 commits intopython:mainfrom
test_io load_tests namespace manipulation#138366vstinner merged 3 commits intopython:mainfrom
Conversation
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.
Contributor
Author
|
Added another commit to fix a gh-133982 issue I found while testing out the split. There are a number of test classes defined inside specific test cases that were referring to |
auvipy
approved these changes
Sep 2, 2025
Member
Done.
Done. |
vstinner
approved these changes
Sep 2, 2025
Member
vstinner
left a comment
There was a problem hiding this comment.
LGTM.
./python -m test test_io --list-cases output is unchanged with this change.
Remove unnecessary pass through self Co-authored-by: Victor Stinner <[email protected]>
Contributor
Author
|
One bot failure buildbot/AMD64 Windows 11 Refleaks PR in |
Member
|
Merged, thanks. |
lkollar
pushed a commit
to lkollar/cpython
that referenced
this pull request
Sep 9, 2025
…ython#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 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reduce what happens in
load_testsso that the next change, moving theBuffered*tests totest_bufferdiois 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
CTestCaseandPyTestCaseprovide were injected directly duringload_tests.CTestCaseandPyTestCaseinherit fromunittest.TestCaseso when the split happens default test discovery will work for the classes intest_bufferedio.test_generalkeeps 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 as tests is out of my current scope.CTestCaseandPyTestCasehave anioclass member which points to the implementation meaning that can be removed from individual test cases which now inherit from them.Tested locally with
./python -m test test_io -uall,walltime,largefile,extralargefile -M16G -j8 -vskip newsas its a test-only change?