<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">&lt;<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>&gt;</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 &lt;<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>&gt;
              [2016-05-31 09:17:33 -0700]:<br>
              <span class="">&gt; I'm looking for a way of getting a
                condition coverage report for python<br>
                &gt; code.<br>
                &gt;<br>
                &gt; We've been using coverage.py .<br>
                &gt;<br>
                &gt; coverage.py appears to, at best, give branch
                coverage in its HTML report.<br>
                &gt; However, it's beginning to look like coverage.py
                can give condition<br>
                &gt; coverage (which is what we prefer). but only via
                its XML report.<br>
                &gt;<br>
                &gt; 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>
                                                              &lt;line
              branch="true" condition-coverage="50% (1/2)" hits="1"
              missing-branches="24" number="23"/&gt;<br>
                                                              &lt;line
              branch="true" condition-coverage="50% (1/2)" hits="1"
              missing-branches="29" number="28"/&gt;<br>
                                                              &lt;line
              branch="true" condition-coverage="50% (1/2)" hits="1"
              missing-branches="99" number="98"/&gt;<br>
                                                              &lt;line
              branch="true" condition-coverage="50% (1/2)" hits="1"
              missing-branches="36" number="14"/&gt;<br>
                                                              &lt;line
              branch="true" condition-coverage="100% (2/2)" hits="1"
              number="18"/&gt;<br>
              <br>
              $ rm coverage.xml<br>
              <br>
              $ ./bin/jenkins-test &gt; /dev/null 2&gt;&amp;1<br>
              <br>
              $ egrep condition coverage.xml | head -5<br>
              cmd output started 2016 Tue May 31 09:52:23 AM PDT<br>
                                                              &lt;line
              branch="true" condition-coverage="50% (1/2)" hits="1"
              missing-branches="24" number="23"/&gt;<br>
                                                              &lt;line
              branch="true" condition-coverage="50% (1/2)" hits="1"
              missing-branches="29" number="28"/&gt;<br>
                                                              &lt;line
              branch="true" condition-coverage="50% (1/2)" hits="1"
              missing-branches="99" number="98"/&gt;<br>
                                                              &lt;line
              branch="true" condition-coverage="50% (1/2)" hits="1"
              missing-branches="36" number="14"/&gt;<br>
                                                              &lt;line
              branch="true" condition-coverage="100% (2/2)" hits="1"
              number="18"/&gt;<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>