Skip to content

Commit e0198af

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 e0198af

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
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

coverage/misc.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,11 @@ def isolate_module(mod):
3232
if mod not in ISOLATED_MODULES:
3333
new_mod = types.ModuleType(mod.__name__)
3434
ISOLATED_MODULES[mod] = new_mod
35-
for name in dir(mod):
35+
attributes = dir(mod)
36+
if mod.__name__ == "sys":
37+
attributes = set(attributes) - set(["__stdout__", "__stdin__",
38+
"stdout", "stdin"])
39+
for name in attributes:
3640
value = getattr(mod, name)
3741
if isinstance(value, types.ModuleType):
3842
value = isolate_module(value)

0 commit comments

Comments
 (0)