Skip to content

bazel coverage produces empty coverage analysis reports and a message about missing GCov when running against a py_test target #3345

@TeodorMalbasic

Description

@TeodorMalbasic

🐞 bug report

Affected Rule

The issue is caused by the rule: py_test()

Is this a regression?

No

Description

After the successful execution of the bazel test command I attempted to add the coverage tool too.

Unfortunately, I get output:

GCov does not exist at the given path: ''
Oct 13, 2025 12:50:34 PM com.google.devtools.coverageoutputgenerator.Main runWithArgs
WARNING: There was no coverage found.

I want to use the coverage (opensource) pip package for gathering coverage data of Python tests. I have no clue why running
bazelisk coverage --combined_report=lcov //... --test_output=all returns that GCov does not exist.

My test scripts are written with unittest framework, and they successfully run with bazelisk test :all --test_output=all

🔬 Minimal Reproduction

https://github.com/TeodorMalbasic/bazel_coverage_target_issue.git

🔥 Exception or Error



 
GCov does not exist at the given path: ''
Oct 13, 2025 12:50:34 PM com.google.devtools.coverageoutputgenerator.Main runWithArgs
WARNING: There was no coverage found.

🌍 Your Environment

Operating System:

  
Ubuntu 24.04
  

Output of bazel version:

  
bazel 8.4.2
  

Rules_python version:

  
Python 3.12.3 on machine, Python 3.12.11 in MODULE.bazel
  

Anything else relevant?

Metadata

Metadata

Assignees

No one assigned

    Labels

    need: reproNeeds a minimal reproduction

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions