From 02c995d45f7114df741bbd644b5810645df98740 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Wed, 3 Aug 2011 21:17:42 -0400 Subject: You can include files in the Python installation, and they will be measured. --- coverage/control.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'coverage/control.py') 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 -- cgit v1.2.1