Skip to content

Commit 8f4e695

Browse files
committed
fix: combine aliases on windows base dirs (ie: X:\) (fixes: nedbat#577)
Signed-off-by: Valentin Lab <[email protected]>
1 parent 37285cb commit 8f4e695

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

coverage/files.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -359,17 +359,19 @@ def add(self, pattern, result):
359359
match an entire tree, and not just its root.
360360
361361
"""
362+
pattern_sep = sep(pattern)
363+
362364
if len(pattern) > 1:
363365
pattern = pattern.rstrip(r"\/")
364366

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

370371
# The pattern is meant to match a filepath. Let's make it absolute
371372
# unless it already is, or is meant to match any prefix.
372-
if not pattern.startswith('*') and not isabs_anywhere(pattern):
373+
if not pattern.startswith('*') and not isabs_anywhere(pattern +
374+
pattern_sep):
373375
pattern = abs_file(pattern)
374376
if not pattern.endswith(pattern_sep):
375377
pattern += pattern_sep

0 commit comments

Comments
 (0)