|
17 | 17 | from coverage.backward import code_object
|
18 | 18 | from coverage.disposition import FileDisposition, disposition_init
|
19 | 19 | from coverage.files import TreeMatcher, FnmatchMatcher, ModuleMatcher
|
20 |
| -from coverage.files import prep_patterns, find_python_files, canonical_filename |
| 20 | +from coverage.files import prep_patterns, find_python_files, canonical_filename, PathAliases |
21 | 21 | from coverage.misc import CoverageException
|
22 | 22 | from coverage.python import source_for_file, source_for_morf
|
23 | 23 |
|
@@ -132,6 +132,7 @@ def __init__(self, warn, debug):
|
132 | 132 |
|
133 | 133 | def configure(self, config):
|
134 | 134 | """Apply the configuration to get ready for decision-time."""
|
| 135 | + aliases = PathAliases.configure(config) |
135 | 136 | for src in config.source or []:
|
136 | 137 | if os.path.isdir(src):
|
137 | 138 | self.source.append(canonical_filename(src))
|
@@ -186,24 +187,24 @@ def debug(msg):
|
186 | 187 | if self.source or self.source_pkgs:
|
187 | 188 | against = []
|
188 | 189 | if self.source:
|
189 |
| - self.source_match = TreeMatcher(self.source) |
| 190 | + self.source_match = TreeMatcher(self.source, aliases=aliases) |
190 | 191 | against.append("trees {!r}".format(self.source_match))
|
191 | 192 | if self.source_pkgs:
|
192 | 193 | self.source_pkgs_match = ModuleMatcher(self.source_pkgs)
|
193 | 194 | against.append("modules {!r}".format(self.source_pkgs_match))
|
194 | 195 | debug("Source matching against " + " and ".join(against))
|
195 | 196 | else:
|
196 | 197 | if self.cover_paths:
|
197 |
| - self.cover_match = TreeMatcher(self.cover_paths) |
| 198 | + self.cover_match = TreeMatcher(self.cover_paths, aliases=aliases) |
198 | 199 | debug("Coverage code matching: {!r}".format(self.cover_match))
|
199 | 200 | if self.pylib_paths:
|
200 |
| - self.pylib_match = TreeMatcher(self.pylib_paths) |
| 201 | + self.pylib_match = TreeMatcher(self.pylib_paths, aliases=aliases) |
201 | 202 | debug("Python stdlib matching: {!r}".format(self.pylib_match))
|
202 | 203 | if self.include:
|
203 |
| - self.include_match = FnmatchMatcher(self.include) |
| 204 | + self.include_match = FnmatchMatcher(self.include, aliases=aliases) |
204 | 205 | debug("Include matching: {!r}".format(self.include_match))
|
205 | 206 | if self.omit:
|
206 |
| - self.omit_match = FnmatchMatcher(self.omit) |
| 207 | + self.omit_match = FnmatchMatcher(self.omit, alieases=alieases) |
207 | 208 | debug("Omit matching: {!r}".format(self.omit_match))
|
208 | 209 |
|
209 | 210 | def should_trace(self, filename, frame=None):
|
|
0 commit comments