cpython/Lib/test/test_pathlib
Barney Gale 805e3368d6
GH-128520: pathlib ABCs: improve protocol for 'openable' objects (#134101)
Rename `pathlib._os.magic_open()` to `vfsopen()`. The new name is a bit
less abstract, and it aligns with the `vfspath()` method added in 5dbd27d.

Per discussion on discourse[^1], adjust `vfsopen()` so that the following
methods may be called:

- `__open_reader__()`
- `__open_writer__(mode)`
- `__open_updater__(mode)`

These three methods return readable, writable, and full duplex file objects
respectively. In the 'writer' method, *mode* is either 'a', 'w' or 'x'. In
the 'updater' method, *mode* is either 'r' or 'w'.

In the pathlib ABCs, replace `ReadablePath.__open_rb__()` with
`__open_reader__()`, and replace `WritablePath.__open_wb__()` with
`__open_writer__()`.

[^1]: https://discuss.python.org/t/open-able-objects/90238

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-09-12 22:25:18 +01:00
..
support GH-128520: pathlib ABCs: improve protocol for 'openable' objects (#134101) 2025-09-12 22:25:18 +01:00
__init__.py
test_copy.py
test_join.py
test_join_posix.py
test_join_windows.py GH-128520: pathlib ABCs: add JoinablePath.__vfspath__() (#133437) 2025-05-12 19:00:36 +01:00
test_pathlib.py Use test.support.is_wasm32 flag for is_emscripten or is_wasi for generic checks (GH-136815) 2025-07-22 12:50:13 -07:00
test_read.py GH-128520: pathlib ABCs: improve protocol for 'openable' objects (#134101) 2025-09-12 22:25:18 +01:00
test_write.py GH-128520: pathlib ABCs: improve protocol for 'openable' objects (#134101) 2025-09-12 22:25:18 +01:00