summaryrefslogtreecommitdiff
path: root/coverage/files.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2015-06-13 21:44:43 -0400
committerNed Batchelder <ned@nedbatchelder.com>2015-06-13 21:44:43 -0400
commit4dc7c52ffa20e9b8444f61092950618066f1a736 (patch)
tree3f03b9e22afbbad4f2e481d52573b3a3ba72b9a9 /coverage/files.py
parentf9a5b120b91e62f86bcd12e54a92fda675534200 (diff)
downloadpython-coveragepy-git-4dc7c52ffa20e9b8444f61092950618066f1a736.tar.gz
Remove FileLocator from PathAliases. Now it always produces canonicalized paths.
Diffstat (limited to 'coverage/files.py')
-rw-r--r--coverage/files.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/coverage/files.py b/coverage/files.py
index 665e2f33..c9afefd8 100644
--- a/coverage/files.py
+++ b/coverage/files.py
@@ -237,12 +237,9 @@ 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, locator=None):
+ def __init__(self):
self.aliases = []
- self.locator = locator
def add(self, pattern, result):
"""Add the `pattern`/`result` pair to the list of aliases.
@@ -295,6 +292,9 @@ class PathAliases(object):
The separator style in the result is made to match that of the result
in the alias.
+ Returns:
+ The mapped path. This is always a canonical filename.
+
"""
for regex, result, pattern_sep, result_sep in self.aliases:
m = regex.match(path)
@@ -302,8 +302,7 @@ class PathAliases(object):
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)
+ new = canonical_filename(new)
return new
return path