<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, May 31, 2016 at 9:41 AM, Florian Bruhin <span dir="ltr"><<a href="mailto:me@the-compiler.org" target="_blank">me@the-compiler.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">* Dan Stromberg <<a href="mailto:dstromberglists@gmail.com">dstromberglists@gmail.com</a>> [2016-05-31 09:17:33 -0700]:<br>
<span class="">> I'm looking for a way of getting a condition coverage report for python<br>
> code.<br>
><br>
> We've been using coverage.py .<br>
><br>
> coverage.py appears to, at best, give branch coverage in its HTML report.<br>
> However, it's beginning to look like coverage.py can give condition<br>
> coverage (which is what we prefer). but only via its XML report.<br>
><br>
> Is that accurate?<br>
<br>
</span>I don't think so.<br>
<br>
AFAIK there's a blogpost by Ned Batchelder about why he hasn't been<br>
able to implement this, but I can't find it right now... <br></blockquote><div><br></div><div>I'm puzzled by this:<br>$ egrep condition coverage.xml | head -5<br> <line branch="true" condition-coverage="50% (1/2)" hits="1" missing-branches="24" number="23"/><br> <line branch="true" condition-coverage="50% (1/2)" hits="1" missing-branches="29" number="28"/><br> <line branch="true" condition-coverage="50% (1/2)" hits="1" missing-branches="99" number="98"/><br> <line branch="true" condition-coverage="50% (1/2)" hits="1" missing-branches="36" number="14"/><br> <line branch="true" condition-coverage="100% (2/2)" hits="1" number="18"/><br><br>$ rm coverage.xml<br><br>$ ./bin/jenkins-test > /dev/null 2>&1<br><br>$ egrep condition coverage.xml | head -5<br>cmd output started 2016 Tue May 31 09:52:23 AM PDT<br> <line branch="true" condition-coverage="50% (1/2)" hits="1" missing-branches="24" number="23"/><br> <line branch="true" condition-coverage="50% (1/2)" hits="1" missing-branches="29" number="28"/><br> <line branch="true" condition-coverage="50% (1/2)" hits="1" missing-branches="99" number="98"/><br> <line branch="true" condition-coverage="50% (1/2)" hits="1" missing-branches="36" number="14"/><br> <line branch="true" condition-coverage="100% (2/2)" hits="1" number="18"/><br><br>./bin/jenkins-test is using nose with --with-coverage - so via the coverage.py plugin .<br><br></div><div>Note the presence of the string "condition-coverage".<br><br>Also, coverage.py's xmlreport.py has:<br> xline.setAttribute(<br> "condition-coverage",<br> "%d%% (%d/%d)" % (100*taken/total, taken, total)<br> )<br><br></div><div><br></div><div>Thanks!</div></div></div></div>