Skip to content

--branch and --concurrency are conflicting #495

Closed
@nedbat

Description

@nedbat

Originally reported by Gabriel Duman (Bitbucket: gabber7, GitHub: gabber7)


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

this is a test script to reproduce

#!python

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

#!bash

> 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.

#!bash

> 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%
>

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcombine

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions