From cc5a8bed398eed0ab9188e86262c04b6dfc086f3 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Wed, 16 Mar 2011 20:32:41 -0400 Subject: Clean-ups --- coverage/control.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'coverage/control.py') diff --git a/coverage/control.py b/coverage/control.py index 514f23d..3369d04 100644 --- a/coverage/control.py +++ b/coverage/control.py @@ -226,8 +226,8 @@ class coverage(object): self._check_for_packages() # Compiled Python files have two filenames: frame.f_code.co_filename is - # the filename at the time the .pyc was compiled. The second name - # is __file__, which is where the .pyc was actually loaded from. Since + # the filename at the time the .pyc was compiled. The second name is + # __file__, which is where the .pyc was actually loaded from. Since # .pyc files can be moved after compilation (for example, by being # installed), we look for __file__ in the frame and prefer it to the # co_filename value. -- cgit v1.2.1 From 43167860f5d36940bd56b0a55d4694ab27fff182 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Mon, 21 Mar 2011 21:40:07 -0400 Subject: --omit and --include now interpret their values more usefully. Fixes #121. --- coverage/control.py | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) (limited to 'coverage/control.py') diff --git a/coverage/control.py b/coverage/control.py index 3369d04..584f093 100644 --- a/coverage/control.py +++ b/coverage/control.py @@ -118,8 +118,8 @@ class coverage(object): else: self.source_pkgs.append(src) - self.omit = self._abs_files(self.config.omit) - self.include = self._abs_files(self.config.include) + self.omit = self._prep_patterns(self.config.omit) + self.include = self._prep_patterns(self.config.include) self.collector = Collector( self._should_trace, timid=self.config.timid, @@ -280,10 +280,24 @@ class coverage(object): self._warnings.append(msg) sys.stderr.write("Coverage.py warning: %s\n" % msg) - def _abs_files(self, files): - """Return a list of absolute file names for the names in `files`.""" - files = files or [] - return [self.file_locator.abs_file(f) for f in files] + def _prep_patterns(self, patterns): + """Prepare the file patterns for use in a `FnmatchMatcher`. + + If a pattern starts with a wildcard, it is used as a pattern + as-is. If it does not start with a wildcard, then it is made + absolute with the current directory. + + If `patterns` is None, an empty list is returned. + + """ + patterns = patterns or [] + prepped = [] + for p in patterns or []: + if p.startswith("*") or p.startswith("?"): + prepped.append(p) + else: + prepped.append(self.file_locator.abs_file(p)) + return prepped def _check_for_packages(self): """Update the source_match matcher with latest imported packages.""" -- cgit v1.2.1 From e2d96d0d57b0b1219f985ba66ab665dcdbd4fd48 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Thu, 24 Mar 2011 22:50:56 -0400 Subject: Remove trailing spaces --- coverage/control.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'coverage/control.py') diff --git a/coverage/control.py b/coverage/control.py index 584f093..dd65661 100644 --- a/coverage/control.py +++ b/coverage/control.py @@ -282,7 +282,7 @@ class coverage(object): def _prep_patterns(self, patterns): """Prepare the file patterns for use in a `FnmatchMatcher`. - + If a pattern starts with a wildcard, it is used as a pattern as-is. If it does not start with a wildcard, then it is made absolute with the current directory. -- cgit v1.2.1