[TIP] Resetting or Restarting coverage.py trace
Ned Batchelder
ned at nedbatchelder.com
Mon Oct 17 04:09:33 PDT 2016
Wouldn't it be easiest to restart the process between the two phases?
--Ned.
On 10/17/16 4:22 AM, Shai Cantor wrote:
> I'm trying to find the coverage of multiple processes that are running
> on multiple test phases.
> For example:
>
> * A CI server that is conducting tests that make HTTP calls to
> another server for functional tests phase.
> * The same CI server is conducting tests that make other HTTP calls
> to the same server as part of the performance test phase.
>
> 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.
>
> On Sun, Oct 16, 2016 at 10:00 PM,
> <testing-in-python-request at lists.idyll.org
> <mailto:testing-in-python-request at lists.idyll.org>> wrote:
>
> Send testing-in-python mailing list submissions to
> testing-in-python at lists.idyll.org
> <mailto:testing-in-python at lists.idyll.org>
>
> To subscribe or unsubscribe via the World Wide Web, visit
> http://lists.idyll.org/listinfo/testing-in-python
> <http://lists.idyll.org/listinfo/testing-in-python>
> or, via email, send a message with subject or body 'help' to
> testing-in-python-request at lists.idyll.org
> <mailto:testing-in-python-request at lists.idyll.org>
>
> You can reach the person managing the list at
> testing-in-python-owner at lists.idyll.org
> <mailto:testing-in-python-owner at lists.idyll.org>
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of testing-in-python digest..."
>
> Today's Topics:
>
> 1. Resetting or Restarting coverage.py trace (Shai Cantor)
> 2. Re: Resetting or Restarting coverage.py trace (Ned Batchelder)
> 3. Re: are the absolute paths in .coverage necessary? (Chris
> Withers)
>
>
> ---------- Forwarded message ----------
> From: Shai Cantor <shai at sealights.io <mailto:shai at sealights.io>>
> To: testing-in-python at lists.idyll.org
> <mailto:testing-in-python at lists.idyll.org>
> Cc:
> Date: Sun, 16 Oct 2016 09:36:42 +0300
> Subject: [TIP] Resetting or Restarting coverage.py trace
> Hi,
>
> So I'm using coverage.py API
>
> import coverage
>
> cov = coverage.Coverage()
> cov.start()
>
> # .. call your code ..
>
> cov.stop()
> cov.save()
>
>
> The main thread creates a coverage instance and starts it.
> 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.
> Problem is that tracing is stopped after I do that. I guess it's
> because I start it from another thread.
>
> Is there a way I can reset/restart coverage from another thread or
> manually clear coverage data?
>
> Thanks
>
>
>
> ---------- Forwarded message ----------
> From: Ned Batchelder <ned at nedbatchelder.com
> <mailto:ned at nedbatchelder.com>>
> To: testing-in-python at lists.idyll.org
> <mailto:testing-in-python at lists.idyll.org>
> Cc:
> Date: Sun, 16 Oct 2016 12:10:48 -0400
> Subject: Re: [TIP] Resetting or Restarting coverage.py trace
> On 10/16/16 2:36 AM, Shai Cantor wrote:
>> Hi,
>>
>> So I'm using coverage.py API
>> import coverage
>>
>> cov = coverage.Coverage()
>> cov.start()
>>
>> # .. call your code ..
>>
>> cov.stop()
>> cov.save()
>>
>> The main thread creates a coverage instance and starts it.
>> 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.
>> Problem is that tracing is stopped after I do that. I guess it's
>> because I start it from another thread.
>>
>> Is there a way I can reset/restart coverage from another thread
>> or manually clear coverage data?
>>
> I haven'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.
>
> --Ned.
>
>
> ---------- Forwarded message ----------
> From: Chris Withers <chris at simplistix.co.uk
> <mailto:chris at simplistix.co.uk>>
> To: Ned Batchelder <ned at nedbatchelder.com
> <mailto:ned at nedbatchelder.com>>,
> "testing-in-python at lists.idyll.org
> <mailto:testing-in-python at lists.idyll.org>"
> <testing-in-python at lists.idyll.org
> <mailto:testing-in-python at lists.idyll.org>>
> Cc:
> Date: Sun, 16 Oct 2016 19:44:38 +0100
> Subject: Re: [TIP] are the absolute paths in .coverage necessary?
> Hi Ned,
>
> 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?
>
> cheers,
>
> Chris
>
>
> On 12/10/2016 22:31, Ned Batchelder wrote:
>
> Chris, as far as I can tell, they do not have to be absolute.
> As you can
> see from the sample of my rc file, you can replace an
> arbitrary prefix
> with *, and it will work just fine. How about this:
>
> [paths]
> mylib =
> mylib
> */workspace/PYTHON/*/mylib
> tests =
> tests
> */workspace/PYTHON/*/tests
>
> --Ned.
>
>
> On 10/12/16 10:59 AM, Chris Withers wrote:
>
> What I currently have is:
>
> [paths]
> mylib =
> mylib
> /data/jenkins/jobs/mylib-test/workspace/PYTHON/*/mylib
> tests =
> tests
> /data/jenkins/jobs/mylib-test/workspace/PYTHON/*/tests
>
> How can I remove the absolute bits of that?
>
> But, back to my original question: why are the paths in
> .coverage
> absolute in the first place? :-)
>
> Chris
>
> On 12/10/2016 15:53, Ned Batchelder wrote:
>
> Chris, can you show the absolute paths you are using?
> I have this in my
> rc file to deal with varieties of CI:
>
> [paths]
> source =
> .
> *\coverage\trunk
> */coverage/trunk
> *\coveragepy
>
> --Ned.
>
>
> On 10/12/16 10:00 AM, Chris Withers wrote:
>
> Hi Ned,
>
> Are the absolute paths necessary in .coverage?
>
> The reason I ask is that if, for example, they
> were relative to the
> cwd, then I wouldn't need a .coveragerc with a
> whole bunch of paths
> predicated on the exact filesystem layout of my CI
> server.
>
> thoughts?
>
> Chris
>
>
>
>
>
> _______________________________________________
> testing-in-python mailing list
> testing-in-python at lists.idyll.org
> <mailto:testing-in-python at lists.idyll.org>
> http://lists.idyll.org/listinfo/testing-in-python
> <http://lists.idyll.org/listinfo/testing-in-python>
>
>
>
>
> _______________________________________________
> testing-in-python mailing list
> testing-in-python at lists.idyll.org
> http://lists.idyll.org/listinfo/testing-in-python
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.idyll.org/pipermail/testing-in-python/attachments/20161017/89ba0a07/attachment.htm>
More information about the testing-in-python
mailing list