[TIP] Reporting coverage for changed lines of code

Ned Batchelder ned at nedbatchelder.com
Wed Apr 25 15:47:32 PDT 2012

On 4/25/2012 1:00 PM, Frank Niessink wrote:
> Hi,
> I was doing some refactoring in a code base with reasonable but not
> perfect unit test coverage. While reviewing my changes I was
> wondering: of the lines changed, which ones are not covered by unit
> tests? If I had a report showing just that, I could make sure that
> whenever I commit a change, the unit test coverage for the changed
> lines would be 100%. Thus continuously improving overall coverage and
> reducing the risk of changes at the same time. Wouldn't that be neat?
I think this is a very interesting idea.  I suspect there will be 
unintended consequences, not just socially, but in the technical sense, 
but that will be interesting to discover.  Coverage.py isn't organized 
yet to be able to do this, since you can't indicate a specific set of 
lines to report on, but it could be done.

> This started out as conversation on twitter (see
> https://twitter.com/#!/fniessink/status/195166296848072704) with Ned
> Batchelder because I was thinking that this would be an excellent
> feature for coverage.py . What do you guys think?
> Thanks, Frank
> _______________________________________________
> testing-in-python mailing list
> testing-in-python at lists.idyll.org
> http://lists.idyll.org/listinfo/testing-in-python

More information about the testing-in-python mailing list