]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
GH-128520: pathlib ABCs: allow tests to be run externally (#131315)
authorBarney Gale <barney.gale@gmail.com>
Fri, 21 Mar 2025 22:18:20 +0000 (22:18 +0000)
committerGitHub <noreply@github.com>
Fri, 21 Mar 2025 22:18:20 +0000 (22:18 +0000)
commitcf9d1a4b6b28a76a49edba4028d5533195172287
treec20da37c6f435fe18a84b59ca83cbb3fae81c91f
parent56d0f9af147b2280ea0af7af5e57df1a01271991
GH-128520: pathlib ABCs: allow tests to be run externally (#131315)

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()`.
Lib/test/test_pathlib/support/__init__.py
Lib/test/test_pathlib/support/lexical_path.py
Lib/test/test_pathlib/support/local_path.py
Lib/test/test_pathlib/support/zip_path.py
Lib/test/test_pathlib/test_copy.py
Lib/test/test_pathlib/test_join.py
Lib/test/test_pathlib/test_join_posix.py
Lib/test/test_pathlib/test_join_windows.py
Lib/test/test_pathlib/test_read.py
Lib/test/test_pathlib/test_write.py