首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >包含coveralls / github操作的Python项目代码覆盖率徽章

包含coveralls / github操作的Python项目代码覆盖率徽章
EN

Stack Overflow用户
提问于 2020-03-29 14:12:30
回答 1查看 2.2K关注 0票数 4

我正在尝试将代码覆盖率%徽章添加到我的repos README.md中

我目前正在使用Github actions来自动化我的pytest测试。我有它自己的工作,但我一直在努力争取覆盖率的徽章。我使用工作服的徽章生成,并基于it looks like coveralls is expecting an lcov.info file。但是,当我查看reporting options for pytest-cov时,我没有看到相应的输出选项。

我尝试过生成其他类型,比如xml,并配置来查找它,但它仍然在coverage文件夹中查找lcov.info。下面是我当前的pythonapp.yml文件。当前失败的步骤是带有它的工作服查找./coverage/lcov.info

任何关于我做错了什么或如何修复的帮助都将非常感谢。

代码语言:javascript
复制
name: tests

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v2
    - name: Set up Python 3.7
      uses: actions/setup-python@v1
      with:
        python-version: 3.7
    - name: Install dependencies
      run: |
        python -m pip install --upgrade pip
        pip install -r requirements.txt
    - name: Lint with flake8
      run: |
        pip install flake8
        # stop the build if there are Python syntax errors or undefined names
        flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
        # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
        flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
    - name: Test with pytest
      run: |
        pip install pytest pytest-cov
        python -m pytest --cov=./myapp --cov-report xml
    - name: Coveralls
      uses: coverallsapp/github-action@master
      with:
        github-token: ${{ secrets.GITHUB_TOKEN }}
        path--to-lcov: coverage.xml
EN

回答 1

Stack Overflow用户

发布于 2021-04-19 05:58:25

在我看来,"path- to -lcov“的参数名中有额外的连字符

根据这里的文档:https://github.com/marketplace/actions/coveralls-github-action

尝试将"path-- to -lcov“更改为"path-to-lcov”

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/60910770

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档