--cov and xdist missing coverage
See original GitHub issueRunning pytest-cov with xdist (py.test -n auto --cov --cov-report=html
) shows a warning at the end of the test run (Coverage.py warning: No data was collected
) and reports 26431/73593 covered statements versus running without xdist (py.test --cov --cov-report=html
) which reports 36879/73593 covered statements.
Versions:
coverage==4.2 pytest-cov==2.3.1 pytest==2.9.2 pytest-xdist==1.15.0
.coveragerc
[run]
source = dir1,dir2,dir3,dir4
branch = True
parallel = True
[report]
# Regexes for lines to exclude from consideration
exclude_lines =
# Have to re-enable the standard pragma
pragma: no cover
# Don't complain if non-runnable code isn't run
if __name__ == .__main__.:
# Don't complain about uncovered code in tests that were supposed to fail
@pytest.mark.xfail
# Always show line numbers of uncovered statements
show_missing = True
I’m going to work on a reproducible sample, but I’m hoping there’s some obvious config error here.
Issue Analytics
- State:
- Created 7 years ago
- Comments:31 (13 by maintainers)
Top Results From Across the Web
Distributed testing (xdist) — pytest-cov 4.0.0 documentation
Distributed testing with dist mode set to “load” will report on the combined coverage of all workers. The workers may be spread out...
Read more >Missing test coverage for class declaration with pytest-cov
Ok, I found a reason. When pytest is invoked from test itself, all imports are done already, and, therefore, they are not counted...
Read more >pytest-cov - Read the Docs
For distributed testing support install pytest-xdist: ... coverage of several test runs you can use the --cov-append option to append this ...
Read more >pytest-cov - PyPI
Pytest plugin for measuring coverage. ... pip install pytest-cov. For distributed testing support install pytest-xdist: ... Name Stmts Miss Cover ...
Read more >METADATA - Brilliant Tech
Home-page: https://github.com/pytest-dev/pytest-cov Author: Marc Schlaich ... e.g. ``--cov-report term-missing:skip-covered`` These three report options ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I ran into this issue when I decided to introduce parallelization to our test-suite. @kmuehlbauer 's fix totally works. This issue should be closed with that remark:
I just came across this via github search. In my case I had to export
COVERAGE_PROCESS_START=/path/to/.coveragerc
and using the folowing lines to my.coveragerc
:Then
xdist
worked correctly together withcov
.