bazel-contrib / bazel-contrib/rules_python

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

未关闭
#3,345 10 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看
need: repro
主要语言
Starlark
星标
688
派生
721
平均合并
15 小时 7 分钟
30 天内合并 PR
76

描述

# 🐞 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?**

贡献指南

打开贡献指南

调研方向

从链接的最小复现开始,运行 `bazelisk coverage --combined_report=lcov //... --test_output=all`,然后将其与成功运行的 `bazelisk test :all --test_output=all` 进行比较。调查如何为 `py_test()` 目标调用 coverage;当该命令生成非空的 coverage 分析报告且没有缺少 GCov 的警告时,即表示完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
python
领域
build-system, testing
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
需要澄清
新手友好度
28/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。