Skip to content

python coverage not supported with --branch #109

Open
@dgw

Description

@dgw

The SQL query below used to parse .coverage for Python projects returns 0 results if coverage was run with --branch on the CLI or with branch = True in .coveragerc.

QUERY = <<-SQL
SELECT file.path, line_bits.numbits
FROM line_bits
INNER JOIN file ON (line_bits.file_id = file.id)
SQL

With this argument/setting, coverage seems not to add any rows in the line_bits table, and coverage-reporter will therefore find that there is "nothing to report" using the above query; only the arc table is populated with --branch, and it isn't queried.

Omitting the --branch argument or removing/commenting out the branch = True configuration setting lets coverage-reporter find results in the .coverage file, with the obvious caveat that only statement coverage data is reported.

Note that without --branch, the arc table is now empty, and line_bits is populated.


I attempted to work around this by running coverage lcov prior to the coverallsapp/github-action@v2 step, and it appears to work, but doesn't seem ideal. With zero code changes, the project's coverage jumped by 0.6% and spot-checking a few places showed a lot of unexpected branch coverage annotations on Coveralls. For example, partially covered branches I checked are now shown as fully covered, and sometimes branch-coverage annotations appear in the Coveralls UI where there is no branch at all:

image

I'm unsure yet whether coverage outputs bad lcov format when branch tracking is enabled, or if coveralls-reporter isn't parsing it correctly. At this point I've only managed to figure out that something isn't working as expected. 😅

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions