pytest-cov icon indicating copy to clipboard operation
pytest-cov copied to clipboard

problem with coverage stats when using multiprocessing

Open franklingu opened this issue 7 years ago • 3 comments

I am using multiprocessing.Process in some file. When I run test just for that file, seems the coverage data is OK.

py.test --cov=data_utils --cov-report=html -vv -s  tests/test_utils_multiprocessing.py

And data:

Coverage for data_utils/utils/_multiprocessing.py : 95% Show keyboard shortcuts 85 statements 81 run 4 missing 0 excluded

But when I run test for whole tests directory the coverage for _multiprocessing.py and tests run after that dropped a lot -- compared to when being run in single file.

py.test --cov=data_utils --cov-report=html -vv -s

Coverage for data_utils/utils/_multiprocessing.py : 47% Show keyboard shortcuts 85 statements 40 run 45 missing 0 excluded

I am using Python 3.6.1 and pytest==3.4.2, pytest-cov==2.5.1,pytest-forked==0.2,pytest-mock==1.7.1 on ubuntu 16.04. I looked at #139 and I think this is not the same issue. The coverage is OK if run single test file but is too low if run the whole directory

franklingu avatar Jun 18 '18 03:06 franklingu