nose-devs/nose — Issue #22: Enhancement: add the ability to exclude code from coverage.py
Author: jpellerin
Created: 2011-12-14 15:55:34+00:00
State: open

I found a couple of problems with the current cover plugin, namely:

- The "--cover-package" option matches modules using startswith() to match
module names. This fails if you have two modules that start with the same
prefix but you only want to coverage test one of them.

- There is no way to exclude certain files from being picked up when using
the "--cover-inclusive" option. For example if you have some platform
specific code that cannot be imported on a specific host platform.

I solved these two issues by adding some new options to the cover.py plugin.

To solve the first issue I added the "--cover-exclude-package" option which
allows developers to specifically exclude certain packages. These are
checked before the specifically included packages. This allows a developer
to test the "foo" module, without testing the "foobar" module.

To solve the second issue I added the "--cover-exclude-file" option which
allows developers to explicitly exclude a given source file (or source
files) from being picked up when using the "--cover-inclusive" option.

A patch is included that adds these features. Could this be rolled into
the trunk? The options provide a lot of flexibility for various difficult
situations.

Google Code Info:
Issue #: 275
Author: jamie.al...@gmail.com
Created On: 2009-06-27T11:36:02.000Z
Closed On: