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

Use pathlib.Path for file path handling #514

Merged
merged 4 commits into from Jul 15, 2022

Conversation

mrlegohead0x45
Copy link
Contributor

This PR changes all file and directory path handling to use pathlib.Path instead of using strings and os.path functions. The initial reason for this is that simply prepending "file://" to the path of the report does not generate a valid URI on Windows, where the directory separator is \, because you end up with something like file://D:\proj\report.html, which uses backslashes, and file URIs are supposed to use forward slashes. Instead we can use the pathlib.Path.as_uri() function to get a valid URI. While I was at it, I changed the rest of the file[s] to use pathlib.Path as well.

@mrlegohead0x45 mrlegohead0x45 marked this pull request as ready for review May 5, 2022 17:55
@BeyondEvil
Copy link
Contributor

Thank you for this!

We've included this in the next-gen project (v4).

We'll make sure to credit you for the contribution. 🙏

Copy link
Contributor

@BeyondEvil BeyondEvil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@BeyondEvil BeyondEvil merged commit 3fbfd25 into pytest-dev:master Jul 15, 2022
@ssbarnea ssbarnea added the bug This issue/PR relates to a bug. label Oct 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue/PR relates to a bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants