如果我:
上传覆盖率结果存在一些问题
无论如何,...Travis都会继续部署。如何阻止特拉维斯在这种情况下进行部署?
部署-不管上传-失败:

。
这是我的.travis.yml
dist: trusty
language: python
python:
- '3.6'
# Install tox and codecov
install:
- pip install tox-travis
- pip install codecov
# Use tox to run tests in the matrix of environments
script:
- tox -r
# Push the results back to codecov
after_success:
- codecov --commit=$TRAVIS_COMMIT"
# Deploy updates on master to pypi, which will only succeed if there's been a version bump
deploy:
provider: pypi
skip_cleanup: true
skip_existing: true
user: me
password:
secure: "stuff"
on:
branch: master发布于 2020-01-09 08:47:09
根据这个https://bitbucket.org/ned/coveragepy/issues/139/easy-check-for-a-certain-coverage-in-tests,如果在覆盖率报告命令中添加--fail,如果代码覆盖率低于给定百分比,它将使用非零退出代码( travis将视为失败)退出。
这将使您的.travis.yml文件的脚本部分看起来如下:
script
- coverage run --source="mytestmodule" setup.py test
- coverage report --fail-under=80当然,你可以用任何你想要的百分比来代替80。
https://stackoverflow.com/questions/59659807
复制相似问题