【发布时间】:2016-06-26 23:10:14
【问题描述】:
我正在尝试让我的 Travis CI 将测试覆盖率数据发送到 Code Climate 服务,但是关于 Code Climate 和 Travis CI 的文档没有详细描述如何使用 Python 执行此操作。根据 Code Climate 和 Travis 文档,它仍然支持它的功能。我试图在没有运气的情况下找到任何可行的示例,并且无法自行完成。
代码气候文档: Setting Up Test Coverage, Readme: codeclimate-test-reporter
特拉维斯 CI 文档: Using Code Climate with Travis CI
我已经在 Travis CI 中设置了 CODECLIMATE_REPO_TOKEN,如本答案所述: https://stackoverflow.com/a/31281481/1754089
我的 .travis.yml 文件:
language: python
python:
- 2.7
install:
- pip install -r requirements.txt
- pip install coverage
- pip install codeclimate-test-reporter
#commands to run tests:
script:
- python mytests.py
- coverage run mytests.py
after_success:
- codeclimate-test-reporter
由于在 Travis 中执行 after_success 行,它在日志视图中给了我这个:
/home/travis/build.sh: line 45: codeclimate-test_reporter: command not found
【问题讨论】:
-
根据您的错误信息,您的脚本中有错字。注意
codeclimate-test_reporter中的下划线。
标签: python python-2.7 continuous-integration travis-ci code-climate