summaryrefslogtreecommitdiff
path: root/coverage/files.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2021-11-06 17:29:09 -0400
committerNed Batchelder <ned@nedbatchelder.com>2021-11-06 18:06:44 -0400
commit1a616da57258bb3a1d6a0fbd05adfcb76155c49c (patch)
tree4d8577be5c1f87f569cbd68c95e1b2dfefda0376 /coverage/files.py
parent2f5c7aefcd33da77e7cf83945634d6169226ec6b (diff)
downloadpython-coveragepy-git-1a616da57258bb3a1d6a0fbd05adfcb76155c49c.tar.gz
fix: remapping paths during combining needs to follow relative_files=True. #1147
Diffstat (limited to 'coverage/files.py')
-rw-r--r--coverage/files.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/coverage/files.py b/coverage/files.py
index acce0507..a721e533 100644
--- a/coverage/files.py
+++ b/coverage/files.py
@@ -326,11 +326,13 @@ class PathAliases:
map a path through those aliases to produce a unified path.
"""
- def __init__(self):
+ def __init__(self, relative=False):
self.aliases = []
+ self.relative = relative
def pprint(self): # pragma: debugging
"""Dump the important parts of the PathAliases, for debugging."""
+ print(f"Aliases (relative={self.relative}):")
for regex, result in self.aliases:
print(f"{regex.pattern!r} --> {result!r}")
@@ -393,7 +395,8 @@ class PathAliases:
if m:
new = path.replace(m.group(0), result)
new = new.replace(sep(path), sep(result))
- new = canonical_filename(new)
+ if not self.relative:
+ new = canonical_filename(new)
return new
return path