[TIP] Fwd: Coverage for threads

Ned Batchelder ned at nedbatchelder.com
Tue May 7 17:28:58 PDT 2019


You shouldn't create a new Coverage object for each thread. Create one 
in your main, and it will handle the threads for you.

Or, just run your program with coverage instead of using the API.

--Ned.

On 5/7/19 5:07 PM, Kyle Lahnakoski wrote:
>
>
> I am using the low level threading library:
>
>      from thread import allocate_lock, get_ident, start_new_thread
>
> When I create a new thread, do I run
>
>      cov = coverage.Coverage()
>      cov.start()
>
> at the start of each thread, as per
> https://coverage.readthedocs.io/en/latest/api.html ?
>
> Which is much like I already do for profiling:
>
>      cprofiler = CProfiler()
>      cprofiler.__enter__()
>
> Thank you
>
>
> _______________________________________________
> testing-in-python mailing list
> testing-in-python at lists.idyll.org
> http://lists.idyll.org/listinfo/testing-in-python



More information about the testing-in-python mailing list