<div dir="ltr">I&#39;m trying to find the coverage of multiple processes that are running on multiple test phases.<div>For example:</div><div><ul><li>A CI server that is conducting tests that make HTTP calls to another server for functional tests phase.<br></li><li>The same CI server is conducting tests that make other HTTP calls to the same server as part of the performance test phase.</li></ul><div>I would like to measure coverage for the functional test phase, reset the coverage and start measuring again from scratch for the performance test phase.</div></div><div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Oct 16, 2016 at 10:00 PM,  <span dir="ltr">&lt;<a href="mailto:testing-in-python-request@lists.idyll.org" target="_blank">testing-in-python-request@lists.idyll.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Send testing-in-python mailing list submissions to<br>
        <a href="mailto:testing-in-python@lists.idyll.org">testing-in-python@lists.idyll.<wbr>org</a><br>
<br>
To subscribe or unsubscribe via the World Wide Web, visit<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>
or, via email, send a message with subject or body &#39;help&#39; to<br>
        <a href="mailto:testing-in-python-request@lists.idyll.org">testing-in-python-request@<wbr>lists.idyll.org</a><br>
<br>
You can reach the person managing the list at<br>
        <a href="mailto:testing-in-python-owner@lists.idyll.org">testing-in-python-owner@lists.<wbr>idyll.org</a><br>
<br>
When replying, please edit your Subject line so it is more specific<br>
than &quot;Re: Contents of testing-in-python digest...&quot;<br>
<br>Today&#39;s Topics:<br>
<br>
   1. Resetting or Restarting coverage.py trace (Shai Cantor)<br>
   2. Re: Resetting or Restarting coverage.py trace (Ned Batchelder)<br>
   3. Re: are the absolute paths in .coverage necessary? (Chris Withers)<br>
<br><br>---------- Forwarded message ----------<br>From: Shai Cantor &lt;<a href="mailto:shai@sealights.io">shai@sealights.io</a>&gt;<br>To: <a href="mailto:testing-in-python@lists.idyll.org">testing-in-python@lists.idyll.org</a><br>Cc: <br>Date: Sun, 16 Oct 2016 09:36:42 +0300<br>Subject: [TIP] Resetting or Restarting coverage.py trace<br><div dir="ltr">Hi,<div><br></div><div>So I&#39;m using coverage.py API</div><div><pre style="box-sizing:border-box;font-family:consolas,&quot;andale mono wt&quot;,&quot;andale mono&quot;,&quot;lucida console&quot;,&quot;lucida sans typewriter&quot;,&quot;dejavu sans mono&quot;,&quot;bitstream vera sans mono&quot;,&quot;liberation mono&quot;,&quot;nimbus mono l&quot;,monaco,&quot;courier new&quot;,courier,monospace;font-size:12px;margin-top:0px;margin-bottom:0px;padding:12px;line-height:1.5;overflow:auto;color:rgb(64,64,64)"><span class="m_3218531326940723117gmail-kn" style="box-sizing:border-box">import</span> <span class="m_3218531326940723117gmail-nn" style="box-sizing:border-box;color:rgb(85,85,85)">coverage</span>

<span class="m_3218531326940723117gmail-n" style="box-sizing:border-box;color:rgb(51,51,51)">cov</span> <span class="m_3218531326940723117gmail-o" style="box-sizing:border-box;font-weight:bold">=</span> <span class="m_3218531326940723117gmail-n" style="box-sizing:border-box;color:rgb(51,51,51)">coverage</span><span class="m_3218531326940723117gmail-o" style="box-sizing:border-box;font-weight:bold">.</span><span class="m_3218531326940723117gmail-n" style="box-sizing:border-box;color:rgb(51,51,51)">Coverage</span><span class="m_3218531326940723117gmail-p" style="box-sizing:border-box">()</span>
<span class="m_3218531326940723117gmail-n" style="box-sizing:border-box;color:rgb(51,51,51)">cov</span><span class="m_3218531326940723117gmail-o" style="box-sizing:border-box;font-weight:bold">.</span><span class="m_3218531326940723117gmail-n" style="box-sizing:border-box;color:rgb(51,51,51)">start</span><span class="m_3218531326940723117gmail-p" style="box-sizing:border-box">()</span>

<span class="m_3218531326940723117gmail-c1" style="box-sizing:border-box;color:rgb(153,153,136);font-style:italic"># .. call your code ..</span>

<span class="m_3218531326940723117gmail-n" style="box-sizing:border-box;color:rgb(51,51,51)">cov</span><span class="m_3218531326940723117gmail-o" style="box-sizing:border-box;font-weight:bold">.</span><span class="m_3218531326940723117gmail-n" style="box-sizing:border-box;color:rgb(51,51,51)">stop</span><span class="m_3218531326940723117gmail-p" style="box-sizing:border-box">()</span>
<span class="m_3218531326940723117gmail-n" style="box-sizing:border-box;color:rgb(51,51,51)">cov</span><span class="m_3218531326940723117gmail-o" style="box-sizing:border-box;font-weight:bold">.</span><span class="m_3218531326940723117gmail-n" style="box-sizing:border-box;color:rgb(51,51,51)">save</span><span class="m_3218531326940723117gmail-p" style="box-sizing:border-box">()</span></pre></div><div><br></div><div>The main thread creates a coverage instance and starts it.</div><div>During the lifetime of the program I have multiple threads and I need every once in while to reset or restart the coverage process (or clear coverage data) from one of the underlying threads.</div><div>Problem is that tracing is stopped after I do that. I guess it&#39;s because I start it from another thread.</div><div><br></div><div>Is there a way I can reset/restart coverage from another thread or manually clear coverage data?</div><div><br></div><div>Thanks</div><div><br></div></div>
<br><br>---------- Forwarded message ----------<br>From: Ned Batchelder &lt;<a href="mailto:ned@nedbatchelder.com">ned@nedbatchelder.com</a>&gt;<br>To: <a href="mailto:testing-in-python@lists.idyll.org">testing-in-python@lists.idyll.org</a><br>Cc: <br>Date: Sun, 16 Oct 2016 12:10:48 -0400<br>Subject: Re: [TIP] Resetting or Restarting coverage.py trace<br>
  
    
  
  <div bgcolor="#FFFFFF" text="#000000">
    On 10/16/16 2:36 AM, Shai Cantor wrote:<br>
    <blockquote type="cite">
      <div dir="ltr">Hi,
        <div><br>
        </div>
        <div>So I&#39;m using coverage.py API</div>
        <div>
          <pre style="box-sizing:border-box;font-family:consolas,&quot;andale mono wt&quot;,&quot;andale mono&quot;,&quot;lucida console&quot;,&quot;lucida sans typewriter&quot;,&quot;dejavu sans mono&quot;,&quot;bitstream vera sans mono&quot;,&quot;liberation mono&quot;,&quot;nimbus mono l&quot;,monaco,&quot;courier new&quot;,courier,monospace;font-size:12px;margin-top:0px;margin-bottom:0px;padding:12px;line-height:1.5;overflow:auto;color:rgb(64,64,64)"><span class="m_7611045549709367566gmail-kn" style="box-sizing:border-box">import</span> <span class="m_7611045549709367566gmail-nn" style="box-sizing:border-box;color:rgb(85,85,85)">coverage</span>

<span class="m_7611045549709367566gmail-n" style="box-sizing:border-box;color:rgb(51,51,51)">cov</span> <span class="m_7611045549709367566gmail-o" style="box-sizing:border-box;font-weight:bold">=</span> <span class="m_7611045549709367566gmail-n" style="box-sizing:border-box;color:rgb(51,51,51)">coverage</span><span class="m_7611045549709367566gmail-o" style="box-sizing:border-box;font-weight:bold">.</span><span class="m_7611045549709367566gmail-n" style="box-sizing:border-box;color:rgb(51,51,51)">Coverage</span><span class="m_7611045549709367566gmail-p" style="box-sizing:border-box">()</span>
<span class="m_7611045549709367566gmail-n" style="box-sizing:border-box;color:rgb(51,51,51)">cov</span><span class="m_7611045549709367566gmail-o" style="box-sizing:border-box;font-weight:bold">.</span><span class="m_7611045549709367566gmail-n" style="box-sizing:border-box;color:rgb(51,51,51)">start</span><span class="m_7611045549709367566gmail-p" style="box-sizing:border-box">()</span>

<span class="m_7611045549709367566gmail-c1" style="box-sizing:border-box;color:rgb(153,153,136);font-style:italic"># .. call your code ..</span>

<span class="m_7611045549709367566gmail-n" style="box-sizing:border-box;color:rgb(51,51,51)">cov</span><span class="m_7611045549709367566gmail-o" style="box-sizing:border-box;font-weight:bold">.</span><span class="m_7611045549709367566gmail-n" style="box-sizing:border-box;color:rgb(51,51,51)">stop</span><span class="m_7611045549709367566gmail-p" style="box-sizing:border-box">()</span>
<span class="m_7611045549709367566gmail-n" style="box-sizing:border-box;color:rgb(51,51,51)">cov</span><span class="m_7611045549709367566gmail-o" style="box-sizing:border-box;font-weight:bold">.</span><span class="m_7611045549709367566gmail-n" style="box-sizing:border-box;color:rgb(51,51,51)">save</span><span class="m_7611045549709367566gmail-p" style="box-sizing:border-box">()</span></pre>
        </div>
        <div><br>
        </div>
        <div>The main thread creates a coverage instance and starts it.</div>
        <div>During the lifetime of the program I have multiple threads
          and I need every once in while to reset or restart the
          coverage process (or clear coverage data) from one of the
          underlying threads.</div>
        <div>Problem is that tracing is stopped after I do that. I guess
          it&#39;s because I start it from another thread.</div>
        <div><br>
        </div>
        <div>Is there a way I can reset/restart coverage from another
          thread or manually clear coverage data?</div>
        <br>
      </div>
    </blockquote>
    I haven&#39;t heard this need before, to occasionally reset or clear the
    coverage data from one of many threads. Can you say more about what
    the bigger picture is here? There might be an easier way to get it
    done.<br>
    <br>
    --Ned.<br>
  </div>

<br><br>---------- Forwarded message ----------<br>From: Chris Withers &lt;<a href="mailto:chris@simplistix.co.uk">chris@simplistix.co.uk</a>&gt;<br>To: Ned Batchelder &lt;<a href="mailto:ned@nedbatchelder.com">ned@nedbatchelder.com</a>&gt;, &quot;<a href="mailto:testing-in-python@lists.idyll.org">testing-in-python@lists.idyll.org</a>&quot; &lt;<a href="mailto:testing-in-python@lists.idyll.org">testing-in-python@lists.idyll.org</a>&gt;<br>Cc: <br>Date: Sun, 16 Oct 2016 19:44:38 +0100<br>Subject: Re: [TIP] are the absolute paths in .coverage necessary?<br>Hi Ned,<br>
<br>
Sorry, I meant: do the paths recorded in the .coverage files need to be absolute or could Coverage be changed to just record the path relatively to the current working directory at the start of execution?<br>
<br>
cheers,<br>
<br>
Chris<br>
<br>
<br>
On 12/10/2016 22:31, Ned Batchelder wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Chris, as far as I can tell, they do not have to be absolute. As you can<br>
see from the sample of my rc file, you can replace an arbitrary prefix<br>
with *, and it will work just fine.  How about this:<br>
<br>
[paths]<br>
mylib =<br>
   mylib<br>
   */workspace/PYTHON/*/mylib<br>
tests =<br>
   tests<br>
   */workspace/PYTHON/*/tests<br>
<br>
--Ned.<br>
<br>
<br>
On 10/12/16 10:59 AM, Chris Withers wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
What I currently have is:<br>
<br>
[paths]<br>
mylib =<br>
   mylib<br>
   /data/jenkins/jobs/mylib-<wbr>test/workspace/PYTHON/*/mylib<br>
tests =<br>
   tests<br>
   /data/jenkins/jobs/mylib-<wbr>test/workspace/PYTHON/*/tests<br>
<br>
How can I remove the absolute bits of that?<br>
<br>
But, back to my original question: why are the paths in .coverage<br>
absolute in the first place? :-)<br>
<br>
Chris<br>
<br>
On 12/10/2016 15:53, Ned Batchelder wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Chris, can you show the absolute paths you are using?  I have this in my<br>
rc file to deal with varieties of CI:<br>
<br>
     [paths]<br>
     source =<br>
         .<br>
         *\coverage\trunk<br>
         */coverage/trunk<br>
         *\coveragepy<br>
<br>
--Ned.<br>
<br>
<br>
On 10/12/16 10:00 AM, Chris Withers wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi Ned,<br>
<br>
Are the absolute paths necessary in .coverage?<br>
<br>
The reason I ask is that if, for example, they were relative to the<br>
cwd, then I wouldn&#39;t need a .coveragerc with a whole bunch of paths<br>
predicated on the exact filesystem layout of my CI server.<br>
<br>
thoughts?<br>
<br>
Chris<br>
</blockquote></blockquote></blockquote></blockquote>
<br>
<br>
<br>
<br>______________________________<wbr>_________________<br>
testing-in-python mailing list<br>
<a href="mailto:testing-in-python@lists.idyll.org">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></div></div>