Changeset 84
- Timestamp:
- Tue Aug 8 09:06:13 2006
- Files:
-
- trunk/nose/plugins/cover.py (modified) (diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
trunk/nose/plugins/cover.py
r76 r84 50 50 help="Include test modules in coverage report " 51 51 "[NOSE_COVER_TESTS]") 52 parser.add_option("--cover-inclusive", action="store_true", 53 dest="cover_inclusive", 54 default=env.get('NOSE_COVER_INCLUSIVE'), 55 help="Include all python files under working " 56 "directory in coverage report. Useful for " 57 "discovering holes in test coverage if not all " 58 "files are imported by the test suite. " 59 "[NOSE_COVER_INCLUSIVE]") 60 52 61 53 62 def configure(self, options, config): … … 65 74 self.coverTests = options.cover_tests 66 75 self.coverPackages = tolist(options.cover_packages) 76 self.coverInclusive = options.cover_inclusive 67 77 if self.coverPackages: 68 78 log.info("Coverage report will include only packages: %s", … … 114 124 # module, we would have already returned True 115 125 return not self.coverPackages 126 127 def wantFile(self, file, package=None): 128 """If inclusive coverage enabled, return true for all source files 129 in wanted packages.""" 130 if self.coverInclusive: 131 if file.endswith(".py"): 132 if package and self.coverPackages: 133 for want in self.coverPackages: 134 if package.startswith(want): 135 return True 136 else: 137 return True 138 return None 139
