[TIP] [coverage] anyway to omit modules rather than files?

meme dough memedough at gmail.com
Wed Jan 25 15:20:42 PST 2012


>>> Is there any way to specify modules to omit rather than files?
>>> Figuring out the filespec and worrying about cross-platform specs
>>> would then go away...
>> Right now, only filename patterns are accepted for omit and include.
>> Have you used "source"? It seems to do what people want most.
> Unless I'm missing something, if I do:
> source=testfixtures
> ...that will also include testfixtures.tests, which contains my unit tests,
> and which I don't want covered.

To set the source root with nose-cov use

nosetests --with-cov --cov=testfixtures

nose-cov controls a few minimal things that override the .coveragerc,
mainly source root option.  See coverage config file section in
documentation at http://pypi.python.org/pypi/nose-cov/1.4

No windows but can you

omit = tests/*


More information about the testing-in-python mailing list