Fix --package-root
tests for Windows and Python 3.13+
#19583
+6
−1
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.
This PR should fix the rest of the test failures in #19545.
A change to
os.path.relpath
in 3.13 seems to have broken the handling of Windows paths beginning with\\
. To resolve this issue, we don't split the drive letter off of the path and instead verify the path is on the current drive. If it isn't it will never resolve to the package root because that must be on the same drive as the CWD:mypy/mypy/main.py
Lines 1571 to 1572 in 5b03024
Keeping the drive letter allows relpath to properly generate a relative path and make the tests pass.
I need to investigate if the relpath change is a regression in CPython.