Restore {Code,TracebackEntry}.path to py.path and add alternative#9440
Restore {Code,TracebackEntry}.path to py.path and add alternative#9440bluetech wants to merge 1 commit intopytest-dev:mainfrom
Conversation
|
The alternative to this as discussed in the issue is to go through with the breaking change. For this PR:
Against this PR:
Overall it will be better to go with the breaking change in this case, i.e. close this PR and document the change as breaking rather than |
90d3862 to
39b914e
Compare
In 92ba96b we have changed the `path` attribute to return a `pathlib.Path` instead of `py.path.local` without a deprecation hoping it would be alright. But these types are somewhat public, reachable through `ExceptionInfo.traceback`, and broke code in practice. So restore them in the legacypath plugin and add `Path` alternatives under a different name - `source_path`. Fix pytest-dev#9423.
39b914e to
93a5cbf
Compare
| def cut( | ||
| self, | ||
| path: Optional[Union[Path, str]] = None, | ||
| path: Optional[Union["os.PathLike[str]", str]] = None, |
There was a problem hiding this comment.
This part also fixes the sybil failure - it passes a string absolute path to cut, which used to work because py.path.local('/foo') == '/foo' but Path('/foo') != '/foo'. So the code now compares strings.
Even if we go with the breaking change option we should get this included in pytest 7.0 (this part is non breaking)
As I commented in the issue, I think we should just go for it, but I'm not against if others prefer to play safe here and go with the PR instead. 👍 |
|
Replaced by #9447. |
In 92ba96b we have changed the
pathattribute to return a
pathlib.Pathinstead ofpy.path.localwithouta deprecation hoping it would be alright. But these types are somewhat
public, reachable through
ExceptionInfo.traceback, and broke code inpractice. So restore them in the legacypath plugin and add
Pathalternatives under a different name -
source_path.Fix #9423.