summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_pathlib/test_write.py
Commit message (Collapse)AuthorAgeFilesLines
* GH-128520: pathlib ABCs tests: use explicit text encoding (#133105)Barney Gale2025-04-281-6/+6
| | | | | Follow-up to fbffd70. Set `encoding='utf-8'` when reading and writing text in the tests for the private pathlib ABCs, which allows the tests to run with `-W error -X warn_default_encoding`
* GH-128520: pathlib ABCs: raise text encoding warnings at correct stack level ↵Barney Gale2025-04-281-0/+22
| | | | | | | (#133051) Ensure that warnings about unspecified text encodings are emitted from `ReadablePath.read_text()`, `WritablePath.write_text()` and `magic_open()` with the correct stack level set.
* GH-128520: pathlib ABCs: validate `magic_open()` arguments (#131617)Barney Gale2025-03-241-0/+3
| | | | | When `pathlib._os.magic_open()` is called to open a path in binary mode, raise `ValueError` if any of the *encoding*, *errors* or *newline* arguments are given. This matches the `open()` built-in.
* GH-128520: pathlib ABCs: allow tests to be run externally (#131315)Barney Gale2025-03-211-7/+14
| | | | | | | | | | | | Adjust the tests for the `pathlib.types` module so that they can be run against the `pathlib-abc` PyPI package, which is a backport of the module for older Python versions. Specifically, we add a `.support.is_pypi` switch that is false in the stdlib and true in the pathlib-abc package. This controls which package we import, and whether or not we run tests against `PurePath` and `Path`. For compatibility with older Python versions, we stop using `zipfile.ZipFile.mkdir()` and `zipfile.ZipInfo._for_archive()`.
* GH-130614: pathlib ABCs: revise test suite for writable paths (#131112)Barney Gale2025-03-121-0/+109
Test `pathlib.types._WritablePath` in a dedicated test module. These tests cover `WritableZipPath`, `WritableLocalPath` and `Path`, where the former two classes are implementations of `_WritablePath` for use in tests.