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 e0198af
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 4 additions & 2 deletions coverage/files.py
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
6 changes: 5 additions & 1 deletion coverage/misc.py
Expand Up @@ -32,7 +32,11 @@ def isolate_module(mod):
if mod not in ISOLATED_MODULES:
new_mod = types.ModuleType(mod.__name__)
ISOLATED_MODULES[mod] = new_mod
for name in dir(mod):
attributes = dir(mod)
if mod.__name__ == "sys":
attributes = set(attributes) - set(["__stdout__", "__stdin__",
"stdout", "stdin"])
for name in attributes:
value = getattr(mod, name)
if isinstance(value, types.ModuleType):
value = isolate_module(value)
Expand Down

0 comments on commit e0198af

Please sign in to comment.