[TIP] Resetting or Restarting coverage.py trace

Ned Batchelder ned at nedbatchelder.com
Sun Oct 16 09:10:48 PDT 2016


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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.idyll.org/pipermail/testing-in-python/attachments/20161016/2837a35f/attachment.html>


More information about the testing-in-python mailing list