[TIP] How do I get coverage on the test modules themselves?

Ned Batchelder ned at nedbatchelder.com
Tue Sep 16 03:45:07 PDT 2014


On 9/15/14 9:46 PM, Mcgregor, Cecil wrote:
>
> I'm using coverage 3.7.1 with python 2.7.3 on Red Hat 4.1.2 linux
>
> I've been attempting to get coverage on the test code themselves. So 
> far coverage
>
> seems to ignore these files.
>
> It's not obvious from the documentation how I can do this.
>
> How do I cover the test_*.py files as part of the coverage reports?
>
Others have explained the "don't cover your tests" mindset.  I like 
coverage-measuring my tests, for the simple reason that it gives me 
assurance that the tests are actually running.  If you've ever 
copy-pasted a test to make a new similar test, but forgot to change the 
method name, you've had tests that don't run.  Coverage can find those 
problems.

You'll have to show us how you are running the tests.  Coverage.py by 
default does not try to exclude test_*.py files.

--Ned.
>
> Thanks
>
>
>
> _______________________________________________
> testing-in-python mailing list
> testing-in-python at lists.idyll.org
> http://lists.idyll.org/listinfo/testing-in-python

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.idyll.org/pipermail/testing-in-python/attachments/20140916/6356bf21/attachment.html>


More information about the testing-in-python mailing list