--branch and --concurrency are conflicting

Issue #495 wontfix
Gabriel Duman
created an issue

i'm not sure if these two feature are meant to be combined.

this is a test script to reproduce

import multiprocessing
import sys


def func(value):
    if value % 2 == 0:
        print value, 'is even'
    else:
        print value, 'is odd'


if __name__ == "__main__":  # pragma: no cover
    values = range(2)
    pool = multiprocessing.Pool(processes=2)
    pool.map(func, values)
    pool.close()
    pool.join()

and here is the result

> coverage --version
Coverage.py, version 4.1 with C extension
Documentation at https://coverage.readthedocs.io
> coverage run --branch --concurrency=multiprocessing test.py
0 is even
1 is odd
> coverage combine
Can't combine line data with arc data
> coverage report
Name      Stmts   Miss Branch BrPart  Cover
-------------------------------------------
test.py       6      3      2      0    38%
>

when i remove the argument --branch the combine command works. sometimes i get a warning that no data was collected. i cannot reproduce this at the moment.

> coverage run --concurrency=multiprocessing test.py
0 is even
1 is odd
Coverage.py warning: No data was collected.
> coverage combine
> coverage report
Name      Stmts   Miss  Cover
-----------------------------
test.py       6      0   100%
>

Comments (4)

  1. Ned Batchelder repo owner

    I'm going to leave this as a documented limitation of the command-line flags. Once programs get complicated enough to use multiprocessing, options should go in a configuration file.

  2. Log in to comment