Reputation: 449
I'm trying to generate code coverage for a python package I work on and created a GitHub action to do this, which uses the codecov-action. The workflow looks like this:
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
When it's run, it outputs an error, which you can view here. Pytest outputs error code 5 - meaning that no tests were found - but when I run it on my computer, it works properly. Why is this happening?
Upvotes: 1
Views: 2031
Reputation: 311
It may be not the case with you but I had this issue when I was adding a Python test in a branch but added a Github action with pytest
to master branch. So, pytest was not finding any tests because there were in fact none.
After I merged master branch with the workflow into that branch with a test, Python build with pytest passed.
Upvotes: 1