Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python relevant lines not properly computed in the coverage #173

Closed
enekomartinmartinez opened this issue Apr 30, 2023 · 2 comments
Closed

Comments

@enekomartinmartinez
Copy link

The coverage computed by pytest in the GHA is correct. However, it seems that Coveralls is not able to interpret the relevant lines, and when a Python line is split shows all the lines as uncovered, except for the last line.

image

image

CI instruction we are using:

      - name: Test and coverage
        run: pytest tests/ --cov=pysd -n 2
      - name: Coveralls
        uses: coverallsapp/github-action@v2
        if: ${{ matrix.python-version == 3.7 && matrix.os == 'ubuntu-latest' }}
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

https://github.com/SDXorg/pysd/blob/6d90f38c36118b0f7f2cb4eb4a274c20ff2c66c9/.github/workflows/ci.yml

We have been using run: coveralls --service=github instead of uses: coverallsapp/github-action@v2, which was uploading the coverage properly, but started failing on Friday.

We have also tried running the coverage with Python 3.7 and 3.11, and any of them adequately computed the total coverage. However, there were differences in the coverage values as described in #108

Thanks a lot!

@mrexox
Copy link
Contributor

mrexox commented May 2, 2023

Hey! Thank you for the feedback. Actually coverage-reporter has only a beta support for Python.

So, I can suggest you adding a following step:

# Create an xml version of coverage report
coverage xml
coveralls -f coverage.xml

Or provide a file option to github action:

- run: coverage xml

- uses: coverallsapp/github-action@v2
  with:
    file: coverage.xml

@enekomartinmartinez
Copy link
Author

Thanks a lot @mrexox. It worked as expected!

Adding the same documentation from https://github.com/coverallsapp/coverage-reporter#pytest-cov-test_tube-beta in this repo may be helpful to avoid further issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants