我正在尝试为我处理的 python 包生成代码覆盖率,并创建了一个 GitHub 操作来执行此操作,它使用codecov-action。工作流程如下所示:
name: Code Coverage
on: [push]
jobs:
run:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
steps:
- uses: actions/checkout@master
- name: Setup Python
uses: actions/setup-python@master
with:
python-version: 3.7
- name: Install dependencies
run: |
pip install pytest
pip install pytest-cov
pip install -r requirements.txt
- name: Generate coverage report
run: |
pytest --cov=./epispot --cov-report=xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
verbose: true
fail_ci_if_error: true
当它运行时,它会输出一个错误,您可以在此处查看。Pytest 输出错误代码 5 - 表示未找到任何测试 - 但是当我在计算机上运行它时,它可以正常工作。为什么会这样?