Sitelet https://github.com/coveragepy/coveragepy/pull/2270
Skip to content

fix: check for multiprocessing in a --concurrency list - #2270

Merged
nedbat merged 3 commits into
coveragepy:mainfrom
VXNCXNX:fix/multiprocessing-in-concurrency-list
Aug 23, 2026
Merged

nedbat merged 3 commits into
coveragepy:mainfrom
VXNCXNX:fix/multiprocessing-in-concurrency-list

Conversation

@VXNCXNX

@VXNCXNX VXNCXNX commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

coverage run refuses run-affecting command-line options alongside --concurrency=multiprocessing, since they cannot reach the subprocesses. The check compares the whole option value with ==, so it never fires for a comma list, and the run proceeds with the parent measuring branch coverage and the subprocesses not:

$ coverage run --concurrency=multiprocessing,thread --branch prog.py
(exit 0, no message)
$ coverage combine
Can't combine statement coverage data with branch data

after:
$ coverage run --concurrency=multiprocessing,thread --branch prog.py
Options affecting multiprocessing must only be specified in a configuration file.
Remove --branch from the command line.
(exit 1)

The comma form is not exotic, doc/migrating.rst tells people to write it: "Now that must be explicitly enabled with --concurrency=multiprocessing,thread". The single value form was refused correctly the whole time.

The fix splits on commas, which is what cmdline.py already does with the same string a few hundred lines up when it builds the Coverage object, so the two now agree on what the option means.

I checked that --concurrency=thread --branch still exits 0, that multiprocessing,thread with no extra flags still exits 0, and that thread,multiprocessing --branch is refused as well.

AI-assisted: written with Claude Code, reviewed and tested by me before sending.

@nedbat

nedbat commented Aug 23, 2026

Copy link
Copy Markdown
Member

Thanks again. Would you like me to credit you in the Contributors list?

@nedbat
nedbat merged commit b9d304d into coveragepy:main Aug 23, 2026
72 checks passed
nedbat added a commit that referenced this pull request Aug 23, 2026
@nedbat

nedbat commented Aug 28, 2026

Copy link
Copy Markdown
Member

This is now released as part of coverage 7.16.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants