Python Code Coverage and Multiprocessing
I've had spent some time trying to make sure coverage works with multiprocessing.Pool
, but it never worked.
I have finally made a fix that makes it work - would be happy if someone directed me if I am doing something wrong.
https://gist.github.com/andreycizov/ee59806a3ac6955c127e511c5e84d2b6
Coverage 4.0 includes a command-line option --concurrency=multiprocessing
to deal with this. You must use coverage combine
afterward. For instance, if your tests are in regression_tests.py
, then you would simply do this at the command line:
coverage run --concurrency=multiprocessing regression_tests.py
coverage combine