summaryrefslogtreecommitdiff
path: root/coverage/files.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2022-11-08 05:30:29 -0500
committerNed Batchelder <ned@nedbatchelder.com>2022-11-08 07:21:40 -0500
commit66657c17d33ccdffa8ca95c8efa9bd4d64bddf5e (patch)
tree3161b067982fac584530d3a48bc8fd9a429f2ba0 /coverage/files.py
parentbb27eb6c844204b979fe76f0f47c7869ef1c2362 (diff)
downloadpython-coveragepy-git-66657c17d33ccdffa8ca95c8efa9bd4d64bddf5e.tar.gz
fix: path-mapped results shouldn't start with ./
Unless the actual result in the config starts with ./
Diffstat (limited to 'coverage/files.py')
-rw-r--r--coverage/files.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/coverage/files.py b/coverage/files.py
index 82f4df31..bfd808ff 100644
--- a/coverage/files.py
+++ b/coverage/files.py
@@ -435,6 +435,9 @@ class PathAliases:
new = new.replace(sep(path), sep(result))
if not self.relative:
new = canonical_filename(new)
+ dot_start = result.startswith(("./", ".\\")) and len(result) > 2
+ if new.startswith(("./", ".\\")) and not dot_start:
+ new = new[2:]
self.debugfn(
f"Matched path {path!r} to rule {original_pattern!r} -> {result!r}, " +
f"producing {new!r}"