-
-
Notifications
You must be signed in to change notification settings - Fork 32.7k
gh-138013: Move test.test_io to be a module #138153
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the modules here be moved into the new package?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
io
module test files. Also starts a path for all theio
module tests to live in a single module for simpler running rather than requiring knowledge of the list ofio
tests which lives in a comment intest_io
.Common test invocatoins (ex.
python -m test test_io -uall -M8G
andpython -m test.test_io
) run the same set of tests after this change as before.I copied
__init__.py
and__main__.py
from 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_io
to 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 theio
tests overall, but happy to explore the problem space if desired.