diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2011-08-03 21:17:42 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2011-08-03 21:17:42 -0400 |
commit | 02c995d45f7114df741bbd644b5810645df98740 (patch) | |
tree | 353dc0ae9a8a46df55e379561d1bf97d66d50e5a /coverage/control.py | |
parent | b16b0b8bb74367803694ebfad1cbdb4ab7969a96 (diff) | |
download | python-coveragepy-02c995d45f7114df741bbd644b5810645df98740.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.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/coverage/control.py b/coverage/control.py index 5ca1ef9..4ba3a03 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 |