Skip to content

Python Coverage does not work #10660

@ulfjack

Description

@ulfjack

I thought that there was an existing issue for this, but I can't find it.

I was able to successfully collect coverage for python code with a modified version of coverage.py:

  1. Use a Bazel binary that include b01c859
  2. Check out the modified coverage.py from https://github.com/ulfjack/coveragepy/tree/lcov-support (this is based on the patch at DO-NOT-MERGE: Patched-on LCOV file format support for coveragepy v4.x nedbat/coveragepy#863 with a small change to make it work with Bazel)
  3. Run bazel:
bazel coverage --test_env=PYTHON_COVERAGE=/path/to/coveragepy/coverage/__main__.py //python:lib_test

Test coverage should be written to bazel-testlogs/python/lib_test/coverage.dat in lcov format.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3We're not considering working on this, but happy to review a PR. (No assignee)coveragestaleIssues or PRs that are stale (no activity for 30 days)team-Rules-PythonNative rules for Pythontype: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions