combine aliases does not work on windows base dir paths (ie: "X:\")

Issue #577 closed
vaab created an issue

I produced some .coverage file under windows that needs to be combined.

The paths to be aliased is "T:\" (context: I'm using a netshare to automate tests in windows VM)

This doesn't get aliased properly when specifying::

source = 


because in, in PathAliases.add(..)...

Problem 1:

you'll have these 3 lines::

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

Notice that first the pattern given is stripped from it's ending slashes (first instruction), and then (last instruction) the function sep(..) is called to guess what is the pattern separator... which will not be possible since all slashes have been removed.

Moving the last instruction before the .rstrip(..) seems the way to go.

Problem 2

Having removed the last "/" will make this path as a relative one ("T:" is relative, and "T:/" is not)... thus these following lines will mess badly with the 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):
        pattern = abs_file(pattern)
    pattern += pattern_sep

A suggested workaround would be to add + pattern_sep in the isabs_anywhere(..) call.

Comments (1)

  1. Log in to comment