cpython/Lib/test/test_io/__init__.py
Cody Maloney 974532e758
gh-138013: Move I/O tests to test_io (#138365)
Centralize `io` tests into the `test_io` module so they are easier to
find and work on. This will make it easier to split `test_general` which
takes 30+ seconds in a debug build on my machine.

This renames `test_bufio` to be `test_bufferedio` so that it matches
the implementation file name (`bufferedio.c`).

Validation performed:
Tests are run in parallel after change:

```bash
./python.exe -m test test_io  -uall,largefile,extralargefile -M12G -j8
```

Docstring reformat in `test_io/__init__.py` looks reasonable:

```python
>>> import test.test_io
>>> help(test.test_io)
```

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-09-03 11:37:06 +02:00

28 lines
1.1 KiB
Python

"""Tests for the io module and its implementations (_io and _pyio)
Tests are split across multiple files to increase
parallelism and focus on specific implementation pieces.
* test_io
* test_bufferedio - tests file buffering
* test_memoryio - tests BytesIO and StringIO
* test_fileio - tests FileIO
* test_file - tests the file interface
* 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
(only enabled with -ulargefile)
* test_free_threading/test_io - tests thread safety of io objects
.. attention::
When writing tests for io, it's important to test both the C and Python
implementations. This is usually done by writing a base test that refers to
the type it is testing as an attribute. Then it provides custom subclasses to
test both implementations. This directory contains lots of examples.
"""
import os
from test.support import load_package_tests
def load_tests(*args):
return load_package_tests(os.path.dirname(__file__), *args)