Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH-128520: pathlib ABCs: allow tests to be run externally #131315

Merged
merged 3 commits into from
Mar 21, 2025

Conversation

barneygale
Copy link
Contributor

@barneygale barneygale commented Mar 16, 2025

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().

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()`.
@barneygale barneygale enabled auto-merge (squash) March 21, 2025 21:54
@barneygale barneygale merged commit cf9d1a4 into python:main Mar 21, 2025
38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip news tests Tests in the Lib/test dir topic-pathlib
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant