Skip to content

code: accept any os.PathLike[str] in Traceback.cut #9447

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

Merged
merged 1 commit into from
Dec 27, 2021

Conversation

bluetech
Copy link
Member

This is extracted from/alternative to #9440 which keeps the breaking change for the path properties but fixes this particular compat issue.

Before 7.0.0rc1, the function accepted Union[str, py.path.local], and
py.path.local compares equal to the string path, so a user was able to
pass the path as a string and it would work. In 7.0.0rc1 we changed the
py.path.local to Path which doesn't compare equal to the string
path, which breaks compatibility (e.g. the sybil package).

This restores compatibility for this function by accepting any
os.PathLike[str] and only comparing the string representations.

Before 7.0.0rc1, the function accepted `Union[str, py.path.local]`, and
`py.path.local` compares equal to the string path, so a user was able to
pass the path as a string and it would work. In 7.0.0rc1 we changed the
`py.path.local` to `Path` which doesn't compare equal to the string
path, which breaks compatibility (e.g. the `sybil` package).

This restores compatibility for this function by accepting any
`os.PathLike[str]` and only comparing the string representations.
@bluetech bluetech added the needs backport applied to PRs, indicates that it should be ported to the current bug-fix branch label Dec 27, 2021
@bluetech bluetech merged commit fcef7e4 into pytest-dev:main Dec 27, 2021
bluetech added a commit to bluetech/pytest that referenced this pull request Dec 27, 2021
code: accept any `os.PathLike[str]` in `Traceback.cut`
(cherry picked from commit fcef7e4)
@bluetech bluetech deleted the code-cut-pathlike branch December 27, 2021 15:03
@The-Compiler The-Compiler added backported and removed needs backport applied to PRs, indicates that it should be ported to the current bug-fix branch labels Jan 3, 2022
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.

3 participants