<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<p>Dan, the XML file uses the Cobertura file format, which used the
word "condition-coverage". The data in the XML report is the same
as in the other reports, just presented differently.</p>
<p>Coverage.py can only measure lines, and branches between lines,
because of the nature of the Python trace function. It has no
visibility into the behavior within a line. So it can't tell
which parts of "if a or b or c:" got run.</p>
<p>There is an old idea for a hackish way to get information like
that, but there would still be significant work to make it usable:
<a class="moz-txt-link-freetext" href="http://nedbatchelder.com/blog/200804/wicked_hack_python_bytecode_tracing.html">http://nedbatchelder.com/blog/200804/wicked_hack_python_bytecode_tracing.html</a><br>
</p>
<p>--Ned.<br>
</p>
<br>
<div class="moz-cite-prefix">On 5/31/16 12:59 PM, Dan Stromberg
wrote:<br>
</div>
<blockquote
cite="mid:CAEf4Emc3wwwg8xW-skZOm=6_+egKzk50zN2oBaeDXckkyjptsg@mail.gmail.com"
type="cite">
<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
moz-do-not-send="true" href="mailto:me@the-compiler.org"
target="_blank"><a class="moz-txt-link-abbreviated" href="mailto:me@the-compiler.org">me@the-compiler.org</a></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
moz-do-not-send="true"
href="mailto:dstromberglists@gmail.com"><a class="moz-txt-link-abbreviated" href="mailto:dstromberglists@gmail.com">dstromberglists@gmail.com</a></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>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
testing-in-python mailing list
<a class="moz-txt-link-abbreviated" href="mailto:testing-in-python@lists.idyll.org">testing-in-python@lists.idyll.org</a>
<a class="moz-txt-link-freetext" href="http://lists.idyll.org/listinfo/testing-in-python">http://lists.idyll.org/listinfo/testing-in-python</a>
</pre>
</blockquote>
<br>
</body>
</html>