Skip to content

Move Buffered tests from test_io to test_bufio #138013

Closed

Description

@cmaloney

Feature or enhancement

Proposal:

test_io is currently over 5000 lines long and tests a range of behaviors of lots of distinct io components. Some work to make it more modular has happened over time and there are a number of tests for specific subsets of io behavior (see: https://github.com/python/cpython/blob/main/Lib/test/test_io.py#L3-L13), including one for Buffered I/O (test_bufio.py, 74 lines currently)

About 1200 lines of test_io are Buffered I/O specific tests which are well isolated / can be moved relatively easily (BufferedReaderTest, BufferedWriterTest, BufferedRWPairTest, and BufferedRandomTest as well as their Py*/C* variants). I'd like to move them from test_io to test_bufio to make it simpler/faster to iterate / test / validate Buffered I/O behavior.

Has this already been discussed elsewhere?

This is a minor feature, which does not need previous discussion elsewhere

Links to previous discussion of this feature:

No response

Linked PRs

Activity

  1. added 2 commits that reference this issue on Sep 2, 2025
  2. cmaloney commented on Sep 2, 2025

    @cmaloney
    ContributorAuthor

    This set of changes takes ./python -m test test_io -uall,walltime,largefile,extralargefile -M16G -j8 from ~34.5s -> ~31.6s for me (64 bit linux workstation).

    That should help reduce the CI long tail a bit (test_io on refleaks builds is often among the "10 slowest tests"). The reduced runtime is largely from increased parallelism (buffered tests run in parallel with other test_io tests now). If you want to test locally, that's the two outstanding PRs + one commit to do the split (cmaloney@cca2b2e)

  3. added 2 commits that reference this issue on Sep 3, 2025
  4. added a commit that references this issue on Sep 3, 2025
  5. added 3 commits that reference this issue on Sep 9, 2025
  6. added a commit that references this issue on Sep 10, 2025
  7. added 2 commits that reference this issue on Sep 11, 2025
  8. added 5 commits that reference this issue on Sep 17, 2025
  9. added a commit that references this issue on Sep 19, 2025
  10. added a commit that references this issue on Sep 19, 2025
  11. added a commit that references this issue on Sep 30, 2025
  12. vstinner commented on Sep 30, 2025

    @vstinner
    Member

    Can we close this issue? Or do you plan to split more tests?

  13. added 3 commits that reference this issue on Sep 30, 2025
  14. cmaloney commented on Sep 30, 2025

    @cmaloney
    ContributorAuthor

    One final split then done GH-139454

  15. added a commit that references this issue on Oct 1, 2025
  16. vstinner commented on Oct 1, 2025

    @vstinner
    Member

    Nice work, thanks @cmaloney!

  17. cmaloney commented on Oct 1, 2025

    @cmaloney
    ContributorAuthor

    Thanks for reviewing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

testsTests in the Lib/test dirtopic-IOtype-refactorCode refactoring (with no changes in behavior)

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions