| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
str.replace rewrote every occurrence of the matched text, so a path that repeats the aliased directory later on was rewritten twice.
The alias result ./mysrc carries a forward separator, so map() keeps forward slashes in relative mode on every platform. Wrapping the expected in os_sep() rewrote it to backslashes on Windows only, so the [True] case failed there while [False] passed (assert_mapped canonicalizes the non-relative expected). Drop os_sep, matching the sibling test_wildcard with the same result.
|
The Windows failure was my test, not the change. In relative mode map() keeps the result's separator, and ./mysrc is forward slashed, so the output stays forward slashed on every platform. My expected value wrapped it in os_sep(), which flips to backslashes on Windows, so the [True] case failed there while [False] passed through canonical_filename first. I dropped the os_sep to match test_wildcard right above it. Pushed, CI should go green. |
Sorry, something went wrong.
|
This is now released as part of coverage 7.16.0. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
PathAliases.map substitutes with str.replace, so once a rule matches it rewrites every occurrence of the matched text, not just the part that matched:
The second /ci/src is part of the file's real location, and it gets rewritten too. The separator normalisation on the next line then runs over the damage, which is where the vendor./mysrc comes from. Combining across machines is where this shows up, since the mapped path either fails the exists check and falls through to the next rule, or lands on the wrong file.
The regex is anchored with match, so slicing at the match bounds is the same thing the code already means.
Two open PRs touch this file, #2120 and #2233, and both change which rule matches, not the substitution. Different line, different failure. Happy to rebase behind either if you would rather land those first.
Tests are 425 passing across test_files.py, test_api.py and test_data.py. Reverting just the files.py line fails the new test in both its relative and absolute forms and nothing else, with the skip count at 7 either way.