coverage "Combine" Finds No Data / "No source for code" in Parallel CI
Splitting tests across parallel or matrix jobs produces multiple .coverage data files that must be combined. Combine fails when the per-job files were not collected, were written without parallel mode, or recorded paths that do not line up across runners.
What this error means
coverage combine reports "No data to combine" or the combined report shows 0% / "No source for code", even though each job measured coverage. The per-job data exists but was not gathered, named, or path-mapped correctly.
$ coverage combine
No data to combine
# or after combine:
No source for code: '/runner/work/job2/src/app.py'.Common causes
Data files not produced in parallel mode
Without parallel = true (or coverage run -p), each job overwrites a single .coverage instead of writing uniquely named .coverage.<id> files to combine.
Per-job files not collected to one place
Matrix jobs run in isolation; their data files must be uploaded as artifacts and downloaded into one directory before combine can see them.
Path mismatch across runners
Different absolute working directories per job make the recorded source paths disagree, so the combined report cannot map back to source without [paths] aliasing.
How to fix it
Enable parallel mode and map paths
Write uniquely named data files per process, then alias the per-runner paths back to one source root.
[tool.coverage.run]
parallel = true
source = ["myapp"]
[tool.coverage.paths]
source = ["src/myapp", "*/site-packages/myapp", "/*/work/*/src/myapp"]Gather per-job data then combine and report
# each matrix job: upload its .coverage.<id> as an artifact
# a final job downloads them all into ./cov, then:
coverage combine ./cov
coverage report --fail-under=85How to prevent it
- Set
parallel = trueand map paths with[tool.coverage.paths]. - Upload/download per-job data files before combining.
- Run combine and the threshold check in one final aggregation job.