Codecov 只报告运行了多少测试

问题描述

我正在使用 GitHub 操作(用于我的 Python 库)来运行上传到 CodeCov 的覆盖率报告。 历经千辛万苦,终于把报告运行起来,上传到CodeCov。问题是报告说我的测试中 100% 的代码都运行了(显然),除了测试之外的所有代码都运行了 0%。 我的 codecov.yml 文件有什么问题导致覆盖率报告只报告来自测试的代码而不是来自 repo 其余部分的代码吗?

Codecov.yml 文件https://github.com/MatthewReid854/reliability/blob/master/.github/workflows/codecov.yml

Codecov 仪表板显示报告结果: https://app.codecov.io/gh/MatthewReid854/reliability

谢谢。

解决方法

来自 Codecov 的 Tom 在这里。

tl;dr https://github.com/thomasrockhu/reliability/pull/1

看起来有一些事情正在发生。首先,您正在 pip 安装可靠性存储库。我认为这是覆盖本地版本的 /** * Get the number of threads awaiting connections from the pool. The return value is extremely transient and is * a point-in-time measurement. * * @return the number of threads awaiting a connection from the pool */ int getThreadsAwaitingConnection(); 模块。这意味着可能会为这些文件而不是本地文件生成覆盖率。

其次,我添加了一个空白的 reliability 文件,如 this thread 所示。

您还应该注意,Codecov 需要为 conftest.py 步骤设置 fetch-depth > 1 或 0。