coveragepy icon indicating copy to clipboard operation
coveragepy copied to clipboard

FAQ: Why do the bodies of functions show as executed, but the def lines do not? - Solution: spawn a new process

Open GadiZimerman opened this issue 3 years ago • 1 comments

from multiprocessing import Process, set_start_method

set_start_method("spawn") process_cov = Process(target=calc_report_coverage, args=(...)) process_cov.start() process_cov.join()

GadiZimerman avatar Aug 31 '22 14:08 GadiZimerman

I think you are suggesting that we add this to the FAQ? This seems like a not-great way to solve the problem. Why not use the coverage run command to run coverage and measure all the code? Or maybe I've misunderstood what you are suggesting?

nedbat avatar Sep 04 '22 11:09 nedbat