-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Fix issue with slashes being turned into backslashes on Windows #12760
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
nicoddemus
merged 11 commits into
pytest-dev:main
from
nauman897:fix/windows-slash-handling
Sep 8, 2024
Merged
Changes from 6 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
88cd113
Fix issue with slashes being turned into backslashes on Windows
nauman897 edf7b11
updated changelog
nauman897 0a08fe9
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] fb5c935
Add tests for nodeid handling
nauman897 abf7413
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] b5e2f0f
Improved `nodeid` handling logic
nauman897 688a530
test: Reproduce use case scenarios using E2E
dongfangtianyu 03e5e41
Merge pull request #1 from dongfangtianyu/windows-slash-handling
nauman897 a9f2e99
Added encoding type while calling `write_text`
nauman897 5b33322
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] b9f6557
Merge branch 'main' into fix/windows-slash-handling
nauman897 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Fixed an issue with backslashes being incorrectly converted in nodeid paths on Windows, ensuring consistent path handling across environments. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just tested this on Windows, on the
main
branch, and it passes... does this fail only on Linux?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @nicoddemus ,
The problem specifically occurs under these circumstances as mentioned in the issue:
The IDs show up correctly in --collect-only, and they show correctly when test_x.py is not in a subfolder, or when pytest is not invoked in the subfolder.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But then the test case should make sure to replicate that scenario, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah. I'll fix that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe @dongfangtianyu has already taken care of it: nauman897#1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @nauman897 ,I have submitted a PR to your repository, hoping that you can review, verify, and merge this modification. It’s not difficult, you can give it a try.
Ideally:
If the actual result is different, it indicates there are still issues with our code, and it should not be merged into pytest’s
main
branch.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @dongfangtianyu for the help with these tests.
I can confirm that:
cwd_relative_nodeid
:I had to make a minor adjustment to the new tests, as Python 3.11 and later requires passing the
encoding_type
param while calling thewrite_text
method.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's cool @nauman897 !
This is a more intuitive output: