Merge pull request #10078 from nicoddemus/pathsep-9791

This commit is contained in:
Bruno Oliveira 2022-06-27 09:58:38 -03:00 committed by GitHub
commit da9a2b584e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 1 deletions

View File

@ -0,0 +1 @@
Fixed a path handling code in ``rewrite.py`` that seems to work fine, but was incorrect and fails in some systems.

View File

@ -190,7 +190,7 @@ class AssertionRewritingHook(importlib.abc.MetaPathFinder, importlib.abc.Loader)
return False
# For matching the name it must be as if it was a filename.
path = PurePath(os.path.sep.join(parts) + ".py")
path = PurePath(*parts).with_suffix(".py")
for pat in self.fnpats:
# if the pattern contains subdirectories ("tests/**.py" for example) we can't bail out based