gh-138013: Move test.test_io to be a module#138153
Conversation
This sets up for having a test_io._support which contains the I/O mocks for sharing between multiple `io` module test files. Also starts a path for all the `io` module tests to live in a single module for simpler running rather than requiring knowledge of the list of `io` tests which lives in `test_io`. Keeps `python -m test test_io -uall -M8g` and `python -m test.test_io` running the same set of tests as before.
The usual pattern is |
|
I was following what I saw in a couple instances (ex. test_string: https://github.com/python/cpython/blob/main/Lib/test/test_string/_support.py, test_zoneinfo: https://github.com/python/cpython/blob/main/Lib/test/test_zoneinfo/_support.py). There's also a couple of The IO Mocks are only useful for testing the two |
|
Another approach here would be to make a |
| # * test_memoryio - tests BytesIO and StringIO | ||
| # * test_fileio - tests FileIO | ||
| # * test_file - tests the file interface | ||
| # * test_io - tests everything else in the io module | ||
| # * test_io.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 |
There was a problem hiding this comment.
Should the modules here be moved into the new package?
There was a problem hiding this comment.
My plan is yes over time, just limiting scope of changes (and PRs) to pieces I'm actively working on changing (Currently Buffered I/O layer). test_bufio I plan to do as part of this overall issue (gh-138013). Not sure how much people rely on the names currently (ex. tracking performance over time by measuring test runtime). Unfortunately there are no benchmarks for CPython I/O in pyperformance currently (is part of my backlog to add).
There was a problem hiding this comment.
The tests can and do move around, we don't make any guarantees here. Performance tests should use the pyperformance suite.
|
If only useful within |
|
Could this get a skip news tag? (Test-only change) |
This sets up for having a test_io._support which contains the I/O mocks for sharing between multiple
iomodule test files. Also starts a path for all theiomodule tests to live in a single module for simpler running rather than requiring knowledge of the list ofiotests which lives in a comment intest_io.Common test invocatoins (ex.
python -m test test_io -uall -M8Gandpython -m test.test_io) run the same set of tests after this change as before.I copied
__init__.pyand__main__.pyfrom other python test sub directory instances; happy to tweak if needed.It is possible to split out the Buffered I/O tests without moving
test_ioto be a module. In that case still will need a module where the common "mocks" live (My tentative plan istest.test_io._support). I think this sets up for more understandable structure to theiotests overall, but happy to explore the problem space if desired.