coveragepy icon indicating copy to clipboard operation
coveragepy copied to clipboard

Multiprocessing reporting not working

Open MarDiehl opened this issue 2 years ago • 3 comments

Describe the bug Code executed by multiprocessing.Pool is not counted.

To Reproduce Tested on Arch Linux (Python 3.10.8, coverage.py 6.5, pytest 7.2.0). To reproduce, make sure to have

pandas>=0.24
numpy>=1.17
scipy>=1.2
h5py>=2.9
vtk>=8.1
matplotlib>=3.0
pyyaml>=3.12
pytest

and run

git clone [email protected]:eisenforschung/DAMASK.git
export PYTHONPATH=${PWD}/DAMASK/python:${PYTHONPATH}
cd DAMASK/python
coverage run --concurrency=multiprocessing -m pytest
coverage combine
coverage report -m

The issue is most obvious for _result.py. It has many static methods (e.g. _add_absolute) which are executed in parallel.

Expected behavior Expected is a coverage of _result.py in the order of 97%, reported is only 86%. The value of 97% is obtained with coverage.py 6.2 on Python 3.8.10 with pytest 6.2.5.

Additional context Output of coverage debug sys coverage_debug.log

MarDiehl avatar Nov 06 '22 11:11 MarDiehl

Note: I've downgraded coverage.py to 5.5 on the setup on which I first detected the issue and I can still reproduce it. So it could be that an adoption to newer Python versions is needed.

MarDiehl avatar Nov 06 '22 12:11 MarDiehl

Thanks for the detailed instructions. But I'm not seeing the difference in results that you are: Here are my numbers for _result.py: coverage==6.5, pytest==7.2.0: 86% coverage==6.2, pytest==7.2.0: 86% coverage==6.2, pytest==6.2.5: 86%

Are there other factors we haven't considered?

nedbat avatar Nov 11 '22 13:11 nedbat

Maybe it is related to the Python version. I got the high coverage for 3.8.x but not for 3.10.x

MarDiehl avatar Nov 12 '22 19:11 MarDiehl