[TIP] coverage and multiprocessing

Chris Withers chris at simplistix.co.uk
Tue Sep 6 14:19:32 PDT 2016


Hi All,

I run my tests like this:

coverage run --concurrency=multiprocessing --source myproject,tests -m 
nose && coverage report --skip-covered --show-missing

Some of the code is only reached by being called by some 
multiprocessing.Pool workers, the pool being instantiated and fed by one 
of the functions under test.

After running the above, I see:

$ ls -lah .coverage*
-rw-r--r--+ 1 chris  staff    25K  6 Sep 19:31 .coverage
-rw-r--r--+ 1 chris  staff     0B  6 Sep 19:30 
.coverage.tweedledee.26019.082222
-rw-r--r--+ 1 chris  staff     0B  6 Sep 19:30 
.coverage.tweedledee.26020.787224
-rw-r--r--+ 1 chris  staff     0B  6 Sep 19:30 
.coverage.tweedledee.26021.467684
-rw-r--r--+ 1 chris  staff     0B  6 Sep 19:30 
.coverage.tweedledee.26022.663538

So, it looks like coverage is trying to record information in the worker 
processes by failing. What might be the issue and how can I fix it?

cheers,

Chris




More information about the testing-in-python mailing list