Skip to content

Add pathlib-compatible junction detection - #284

Open
Ayham970 wants to merge 1 commit into
jaraco:mainfrom
Ayham970:add-is-junction
Open

Ayham970 wants to merge 1 commit into
jaraco:mainfrom
Ayham970:add-is-junction

Conversation

@Ayham970

Copy link
Copy Markdown

Add Path.is_junction() alongside the existing filesystem predicates, delegating to self.module.isjunction. The method is available on Python 3.12 and later, matching the version that introduced the pathlib and os.path APIs.

This lets code using pathlib's junction predicate also accept path.Path, as part of the compatibility goal in #214. The tests cover ordinary files and directories, missing and invalid paths, a real Windows junction, and a junction after its target is removed. This PR is independent of #283.

Validation on Windows / Python 3.13:

  • Both new tests fail on the original code with AttributeError and pass with this change. The Windows test creates a real junction.
  • tox -e py313: 148 passed, 7 skipped, and the same 12 symlink-privilege failures/errors seen before this change (WinError 1314). Formatting and type checks passed.
  • Mypy with --python-version 3.10 also passed.
  • tox -e docs: Sphinx with warnings treated as errors and sphinx-lint passed.

AI disclosure: OpenAI Codex prepared this change and ran the local validation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant