<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <p>Tom, I appreciate the work you put into investigation.</p>
    <p>The reason gamma.py only marks line 14 as covered is because the
      rest of the file is executed before you start measuring coverage. 
      Setup.py imports bibliopixel/__init__.py, which imports gamma.py,
      which executes all of the lines in the file except for line 14. 
      Then setup.py starts coverage, and then your tests run, executing
      line 14.</p>
    <p>You are doing a few things you perhaps should not.  Importing
      your product code into setup.py can be dangerous, because it might
      mean you need your requirements before you've had a chance to
      install your requirements.  You have no requirements, so you don't
      have this problem, but many projects go to great lengths to avoid
      importing the product code into setup.py for this reason.  If you
      didn't import it, your coverage issue would be solved.</p>
    <p>Another unusual thing here is using setup.py to run tests. 
      Although the distutils docs describe this possibility, most
      projects don't do it.  They use setup.py for distribution work
      (building and installing kits), but not for other development
      tasks.  You have a tox.ini, but are only using it to configure
      flake8! That is very unusual.  Use tox to run your tests.</p>
    <p>I hope this doesn't come off as too bossy.. :)</p>
    <p>--Ned.<br>
    </p>
    <br>
    <div class="moz-cite-prefix">On 1/28/17 12:36 PM, Tom Swirly wrote:<br>
    </div>
    <blockquote
cite="mid:CAOuQWfUz-Y-0vcPbCaYRmn9vGqKCtQbU=cOw0UwyW4nYhNby+w@mail.gmail.com"
      type="cite">
      <div dir="ltr">Greetings, testy people.  Thanks for this excellent
        package!
        <div><br>
          <div><br>
          </div>
          <div>I discovered coverage.py last week and have been dropping
            it into various projects I'm on.  One of them only has a
            strangeness and I'd like to figure it out.</div>
          <div><br>
          </div>
          <div>The project is quite vanilla and doesn't use any of the
            trouble techniques listed here:  <a moz-do-not-send="true"
              href="https://coverage.readthedocs.io/en/coverage-4.3.4/trouble.html">https://coverage.readthedocs.io/en/coverage-4.3.4/trouble.html</a>
             </div>
          <div><br>
          </div>
          <div>
            <div>--timid had no effect.</div>
          </div>
          <div><br>
          </div>
          <div><br>
          </div>
          <div>The issue: when I run coverage <a moz-do-not-send="true"
href="http://coverage%20run%20-m%20unittest%20discover%20test%20%5C*_test.py">from
              setup.py</a> this file <a moz-do-not-send="true"
href="https://github.com/ManiacalLabs/BiblioPixel/blob/dev/bibliopixel/gamma.py">gamma.py</a> is
            marked as having only 6% coverage - nothing except line <a
              moz-do-not-send="true"
href="https://github.com/ManiacalLabs/BiblioPixel/blob/dev/bibliopixel/gamma.py#L14">14</a>.
              </div>
          <div><br>
          </div>
          <div>I don't even see how that would be possible, but more,
            there's an explicit test that at least <a
              moz-do-not-send="true"
href="https://github.com/ManiacalLabs/BiblioPixel/blob/dev/test/gamma_test.py">loads
              the file</a>, even if it doesn't test the values - and
            yes, I can see that test run in my results.<br>
          </div>
        </div>
        <div>
          <div><br>
          </div>
          <div>
            <div>If I run coverage.py from the command line, like this:</div>
            <div><br>
            </div>
          </div>
          <blockquote style="margin:0px 0px 0px
            40px;border:none;padding:0px"><font face="monospace,
              monospace">coverage run -m unittest discover test
              \*_test.py .</font></blockquote>
          <div><br>
          </div>
          <div> I see 100% coverage as expected. </div>
        </div>
        <div><br>
        </div>
        <div>
          <div><br>
          </div>
          <div><br>
          </div>
          <div>Generally, I hate hitting up mailing lists until I have
            had a chance to debug the package I'm whining about ;-), but
            in this case I'm really not quite sure how to debug
            coverage.py, and I see no bug report I can camp on.  (I
            don't think <a moz-do-not-send="true"
href="https://bitbucket.org/ned/coveragepy/issues/280/allow-test-suite-run-via-python-setuppy">this
              one</a> is it...)</div>
          <div><br>
          </div>
          <div>Thanks in advance!</div>
          <div>
            <div><br>
            </div>
            -- <br>
            <div class="gmail_signature">     /t<br>
              <br>
              <a moz-do-not-send="true" href="http://radio.swirly.com"
                target="_blank">http://radio.swirly.com</a> - art music
              radio 24/7 366/1000</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>