summaryrefslogtreecommitdiff
path: root/coverage/control.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2011-08-03 21:17:42 -0400
committerNed Batchelder <ned@nedbatchelder.com>2011-08-03 21:17:42 -0400
commit06e4538fca309d796d6e8f899bcad74146a96ff3 (patch)
treebdfdecfd0366b24cddf8ae0fe51c62f3cc6186fe /coverage/control.py
parent574d041fbbbbfda3fc4fcaff65629dd04c8eaa70 (diff)
downloadpython-coveragepy-git-06e4538fca309d796d6e8f899bcad74146a96ff3.tar.gz
You can include files in the Python installation, and they will be measured.
Diffstat (limited to 'coverage/control.py')
-rw-r--r--coverage/control.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/coverage/control.py b/coverage/control.py
index 5ca1ef95..4ba3a034 100644
--- a/coverage/control.py
+++ b/coverage/control.py
@@ -248,12 +248,16 @@ class coverage(object):
canonical = self.file_locator.canonical_filename(filename)
- # If the user specified source, then that's authoritative about what to
- # measure. If they didn't, then we have to exclude the stdlib and
- # coverage.py directories.
+ # If the user specified source or include, then that's authoritative
+ # about the outer bound of what to measure and we don't have to apply
+ # any canned exclusions. If they didn't, then we have to exclude the
+ # stdlib and coverage.py directories.
if self.source_match:
if not self.source_match.match(canonical):
return False
+ elif self.include_match:
+ if not self.include_match.match(canonical):
+ return False
else:
# If we aren't supposed to trace installed code, then check if this
# is near the Python standard library and skip it if so.
@@ -265,9 +269,7 @@ class coverage(object):
if self.cover_match and self.cover_match.match(canonical):
return False
- # Check the file against the include and omit patterns.
- if self.include_match and not self.include_match.match(canonical):
- return False
+ # Check the file against the omit pattern.
if self.omit_match and self.omit_match.match(canonical):
return False