作者:寻找初心 | 来源:互联网 | 2022-11-26 08:14
我正在尝试在我的公共travis存储库上设置codecov,到目前为止,还无法成功生成报告并将其上载到codecov.io。我似乎在终端上收到了一个错误的报告,说我的代码中有0%被警告覆盖了。
据我所知,我的.travis.yml和shell脚本完全符合pytest-cov和codecov文档中指定的约定。
我的travis终端包含完整的日志在这里:https : //www.travis-ci.com/jmaggio14/imagepypelines/jobs/163802897#L681
我的回购可以在这里找到:https : //github.com/jmaggio14/imagepypelines/tree/89a6bbc2fadc94a51570d80be356941df1a87a87
我的(缩短的).travis.yml文件如下:
sudo: false
language: python
python:
- 2.7
- 3.4
- 3.5
- 3.6
install:
# I removed some other lines for readability here
- pip install codecov pytest-cov hypothesis
script:
# running tests and code coverage report
- py.test --cov=imagepypelines tests/
after_success:
- codecov
我最终收到以下警告和一条消息,指出我的测试覆盖了我的代码的0%
Coverage.py warning: No data was collected. (no-data-collected)
Will Keeling..
10
我重现了在本地运行测试的问题,并发现Coverage需要该tests
文件夹包含一个,__init__.py
然后才能收集任何数据。
我将其添加__init__.py
到该tests
文件夹中,然后覆盖率按预期收集了数据。
1> Will Keeling..:
我重现了在本地运行测试的问题,并发现Coverage需要该tests
文件夹包含一个,__init__.py
然后才能收集任何数据。
我将其添加__init__.py
到该tests
文件夹中,然后覆盖率按预期收集了数据。