Skip to content

Commit

Permalink
fix: combine aliases on windows base dirs (ie: X:\) (fixes: nedba…
Browse files Browse the repository at this point in the history
…t#577)

Signed-off-by: Valentin Lab <valentin.lab@kalysto.org>
  • Loading branch information
vaab committed Dec 14, 2020
1 parent 37285cb commit 8f4e695
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions coverage/files.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,17 +359,19 @@ def add(self, pattern, result):
match an entire tree, and not just its root.
"""
pattern_sep = sep(pattern)

if len(pattern) > 1:
pattern = pattern.rstrip(r"\/")

# The pattern can't end with a wildcard component.
if pattern.endswith("*"):
raise CoverageException("Pattern must not end with wildcards.")
pattern_sep = sep(pattern)

# The pattern is meant to match a filepath. Let's make it absolute
# unless it already is, or is meant to match any prefix.
if not pattern.startswith('*') and not isabs_anywhere(pattern):
if not pattern.startswith('*') and not isabs_anywhere(pattern +
pattern_sep):
pattern = abs_file(pattern)
if not pattern.endswith(pattern_sep):
pattern += pattern_sep
Expand Down

0 comments on commit 8f4e695

Please sign in to comment.