From f5a27f754d464c9b4d88396cbfd54ff15c891b8c Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Sat, 3 Sep 2011 15:43:51 -0400 Subject: Fix the [paths] feature to actually work for reporting. --- coverage/files.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'coverage/files.py') diff --git a/coverage/files.py b/coverage/files.py index 7258acc..53dc099 100644 --- a/coverage/files.py +++ b/coverage/files.py @@ -139,9 +139,12 @@ class PathAliases(object): A `PathAliases` object tracks a list of pattern/result pairs, and can map a path through those aliases to produce a unified path. + `locator` is a FileLocator that is used to canonicalize the results. + """ - def __init__(self): + def __init__(self, locator=None): self.aliases = [] + self.locator = locator def add(self, pattern, result): """Add the `pattern`/`result` pair to the list of aliases. @@ -191,12 +194,15 @@ class PathAliases(object): in the alias. """ + opath = path for regex, result, pattern_sep, result_sep in self.aliases: m = regex.match(path) if m: new = path.replace(m.group(0), result) if pattern_sep != result_sep: new = new.replace(pattern_sep, result_sep) + if self.locator: + new = self.locator.canonical_filename(new) return new return path -- cgit v1.2.1