<div dir="ltr">Hi all,<div><br></div><div>I finally got back to trying this and I hit a road block.  In order to use this from Tox, I would need to do something like this:</div><div><br></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div>[testenv]</div><div>setenv =</div><div>  COVERAGE_PLATFORM=...  # current platform here</div><div>commands =</div><div>  coverage erase</div><div>  coverage run -m ...</div><div>  coverage report ...</div></blockquote><div><br></div><div>There&#39;s a V2 configuration specification[1] that would allow this:</div><div><br></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><div>[testenv]</div></div><div><div>setenv =</div></div><div><div>  win: COVERAGE_PLATFORM=win32</div></div><div><div>  linux: COVERAGE_PLATFORM=posix</div></div><div><div>  darwin: COVERAGE_PLATFORM=posix</div></div><div><div>commands =</div></div><div><div>  coverage erase</div></div><div><div>  coverage run -m ...</div></div><div><div>  coverage report ...</div></div></blockquote><div><br></div><div>[1]: <a href="https://tox.readthedocs.io/en/latest/config-v2.html">https://tox.readthedocs.io/en/latest/config-v2.html</a></div><div><br></div><div>However, that doesn&#39;t seem to be supported by Tox 2.3.1.</div><div><br></div><div>Any plans to implement this part of the Tox V2 configuration specification soon?  If not, can I help out?</div><div><br></div><div>André</div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Aug 2, 2016 at 11:21 AM, André Caron <span dir="ltr">&lt;<a href="mailto:andre.l.caron@gmail.com" target="_blank">andre.l.caron@gmail.com</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"><div dir="ltr">Yes, I know.  I&#39;ve used the coverage combine function before, that&#39;s the easy part.  It&#39;s just that adding this to our CI infrastructure&#39;s automatic build status (which is my end goal) with this technique involves touching a BitBucket server plug-in, our legacy Anthill-based build machines and I don&#39;t know what else and this will take some time from another team that&#39;s really busy ATM.  We&#39;ll get there eventually, I&#39;m just not that team&#39;s top priority right now.<div><br></div><div>Honestly, finding a way to get 100% by ignoring platform-specific code is way easier for me in the short term.</div><div><br></div><div>Thanks for the suggestion though :-)</div><span class=""><font color="#888888"><div><br></div><div>André</div></font></span></div><div class=""><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Aug 2, 2016 at 11:07 AM, Chris Withers <span dir="ltr">&lt;<a href="mailto:chris@withers.org" target="_blank">chris@withers.org</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">
  
    
  
  <div bgcolor="#FFFFFF" text="#000000">
    <p>If you can copy files from it, you can use coverage combine ;-)<br>
    </p><div><div>
    <br>
    <div>On 02/08/2016 15:23, André Caron wrote:<br>
    </div>
    <blockquote type="cite">
      <div dir="ltr">@Chris: yeah, like I said in my original post,
        that&#39;s the ideal approach.  I&#39;ve worked with this technique
        using <a href="http://coveralls.io" target="_blank">coveralls.io</a>
        before and I really like it.  Problem is I&#39;m currently running
        on some corporate build infrastructure (not my call) that&#39;s
        really slow to change and I won&#39;t be able to get that quickly
        enough.  Was looking for some other ideas as a temporary work
        around to buy some time.
        <div><br>
        </div>
        <div>André</div>
      </div>
      <div class="gmail_extra"><br>
        <div class="gmail_quote">On Tue, Aug 2, 2016 at 7:35 AM, Ned
          Batchelder <span dir="ltr">&lt;<a href="mailto:ned@nedbatchelder.com" target="_blank">ned@nedbatchelder.com</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">
            <div bgcolor="#FFFFFF" text="#000000">
              <p>This is definitely the most common approach.  Some
                people want to see that they have complete coverage on
                each platform independently, though I have never tried
                that myself.  André indicated he could not use combine
                for whatever reason, not sure why.</p>
              <span><font color="#888888">
                  <p>--Ned.<br>
                  </p>
                </font></span>
              <div>
                <div> <br>
                  <div>On 8/2/16 6:27 AM, Chris Withers wrote:<br>
                  </div>
                  <blockquote type="cite">
                    <p>When I hit this, I just ran the tests on the
                      various platforms and used &quot;coverage conbine&quot; to
                      get them into one place before making assertions.</p>
                    <p>cheers,</p>
                    <p>Chris<br>
                    </p>
                    <br>
                    <div>On 27/07/2016 18:56, André Caron wrote:<br>
                    </div>
                    <blockquote type="cite">
                      <div dir="ltr">Neat!  Looks like a winner, at
                        least until I have more than 2 platforms (this
                        mechanism being based on exclusion, I have to
                        &quot;negate&quot; the platform, which may yield multiple
                        results).
                        <div><br>
                        </div>
                        <div>André</div>
                      </div>
                      <div class="gmail_extra"><br>
                        <div class="gmail_quote">On Wed, Jul 27, 2016 at
                          9:54 AM, Ned Batchelder <span dir="ltr">&lt;<a href="mailto:ned@nedbatchelder.com" target="_blank">ned@nedbatchelder.com</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">
                            <div bgcolor="#FFFFFF" text="#000000">
                              <p>You can use environment variables in
                                the .coveragerc file, so you can create
                                a pattern for pragmas that uses
                                environmental data.  For example: <a href="https://github.com/habnabit/ebb-lint/blob/master/.coveragerc" target="_blank">https://github.com/habnabit/<wbr>ebb-lint/blob/master/.<wbr>coveragerc</a>
                                :<br>
                              </p>
                              <blockquote>
                                <p><tt>[report]</tt><tt><br>
                                  </tt><tt>exclude_lines =</tt><tt><br>
                                  </tt><tt>    pragma: no ${TOX_ENVNAME}</tt><tt><br>
                                  </tt><tt>    pragma: no ?cover</tt><br>
                                </p>
                              </blockquote>
                              <p>--Ned.<br>
                              </p>
                              <div>
                                <div>
                                  <p><br>
                                  </p>
                                  <p> </p>
                                  <div>On 7/26/16 6:33 PM, André Caron
                                    wrote:<br>
                                  </div>
                                </div>
                              </div>
                              <blockquote type="cite">
                                <div>
                                  <div>
                                    <div dir="ltr">Hi all,
                                      <div><br>
                                      </div>
                                      <div>I have some code base that
                                        has platform-specific code,
                                        mostly related to how to handle
                                        SIGINT and CTRL-C for which I
                                        like to use `coverage report
                                        --fail-under=100`.  Problem is
                                        that some code only runs on one
                                        OS, so coverage is always
                                        partial in those cases and it&#39;s
                                        not so straightforward.</div>
                                      <div><br>
                                      </div>
                                      <div>I&#39;ve used Coveralls for some
                                        open source projects and their
                                        solution AFAICT seems to be to
                                        collect the `.coverage` files in
                                        a central location and then
                                        combine the coverage files,
                                        after which you can run the
                                        actual reporting.</div>
                                      <div><br>
                                      </div>
                                      <div>However, I&#39;m not in a
                                        position to use Coveralls for
                                        this project and integrating a
                                        distributed coverage combine is
                                        not viable in the short/medium
                                        term.</div>
                                      <div><br>
                                      </div>
                                      <div>I&#39;m looking for suggestions
                                        on a quick and dirty way to
                                        solve this.</div>
                                      <div><br>
                                      </div>
                                      <div>One thing I thought of was
                                        using coverage&#39;s `exclude_lines`
                                        option [1] with a platform
                                        specific token to get this:</div>
                                      <div><br>
                                      </div>
                                      <blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px">
                                        <div>if sys.platform == &#39;win32&#39;:
                                           # pragma: cover win32</div>
                                      </blockquote>
                                      <div><br>
                                      </div>
                                      <div>I guess this works, but it
                                        requires that I have a
                                        platform-specific configuration
                                        file (e.g. via duplicatation or
                                        generation from a template).</div>
                                      <div><br>
                                      </div>
                                      <div>Anybody have any better
                                        ideas?</div>
                                      <div><br>
                                        Thanks,</div>
                                      <div><br>
                                      </div>
                                      <div>André</div>
                                      <div><br>
                                      </div>
                                      <div>[1]: <a href="https://coverage.readthedocs.io/en/coverage-4.1/excluding.html#advanced-exclusion" target="_blank">https://coverage.<wbr>readthedocs.io/en/coverage-4.<wbr>1/excluding.html#advanced-<wbr>exclusion</a></div>
                                    </div>
                                    <br>
                                    <fieldset></fieldset>
                                    <br>
                                  </div>
                                </div>
                                <pre>______________________________<wbr>_________________
testing-in-python mailing list
<a href="mailto:testing-in-python@lists.idyll.org" target="_blank">testing-in-python@lists.idyll.<wbr>org</a>
<a href="http://lists.idyll.org/listinfo/testing-in-python" target="_blank">http://lists.idyll.org/<wbr>listinfo/testing-in-python</a>
</pre>
                              </blockquote>
                              <br>
                            </div>
                            <br>
______________________________<wbr>_________________<br>
                            testing-in-python mailing list<br>
                            <a href="mailto:testing-in-python@lists.idyll.org" target="_blank">testing-in-python@lists.idyll.<wbr>org</a><br>
                            <a href="http://lists.idyll.org/listinfo/testing-in-python" rel="noreferrer" target="_blank">http://lists.idyll.org/<wbr>listinfo/testing-in-python</a><br>
                            <br>
                          </blockquote>
                        </div>
                        <br>
                      </div>
                      <br>
                      <fieldset></fieldset>
                      <br>
                      <pre>______________________________<wbr>_________________
testing-in-python mailing list
<a href="mailto:testing-in-python@lists.idyll.org" target="_blank">testing-in-python@lists.idyll.<wbr>org</a>
<a href="http://lists.idyll.org/listinfo/testing-in-python" target="_blank">http://lists.idyll.org/<wbr>listinfo/testing-in-python</a>
</pre>
                    </blockquote>
                    <br>
                  </blockquote>
                  <br>
                </div>
              </div>
            </div>
          </blockquote>
        </div>
        <br>
      </div>
    </blockquote>
    <br>
  </div></div></div>

</blockquote></div><br></div>
</div></div></blockquote></div><br></div></div>