codeclimate-action icon indicating copy to clipboard operation
codeclimate-action copied to clipboard

CoveragePy Formatter not found.

Open Jsyro opened this issue 4 years ago • 6 comments

Describe the bug I'm attempting to use this action to report pytest results on a flask application. After the tests successfully run, the after-build job cannot find the CoveragePy package to use as a formatter.

Version v2.7.4

Example links

  1. Error run with debug on https://github.com/bcgov/mines-digital-trust/runs/1533132459?check_suite_focus=true

Expected behaviour coveragePY command runs the testsuite, but the cc-test-reporter after-build command doesn't find it. It is the supported python package by code climate. https://docs.codeclimate.com/docs/configuring-test-coverage

Jsyro avatar Dec 10 '20 20:12 Jsyro

@Jsyro the error message tells me the CodeClimate reporter cannot figure out how to format your coverage output.

Are you able to upload the coverage manually after your tests run using the CC reporter manually? You can follow the documentation — https://docs.codeclimate.com/docs/test-coverage-troubleshooting-tips

paambaati avatar Dec 11 '20 15:12 paambaati

I am probably too late here 😬 but would like to answer how I resolved it.

@Jsyro I had the same issue.

You should run the coverage run command first, ( can be a separate step) then run coverage report via coverageCommand parameter with the action in the next step.

The coverage report command looks for the coverage.xml file to be present in the same folder to generate the report. I used the following commands stepwise to upload the result to code climate, and it worked.

- name: Generate the coverage report
  run: |
    coverage run --source=test -m pytest
    coverage xml -o coverage.xml # explicitely exporting coverage file to be read by coverage report command.

- name: Publish code coverage to code climate
  uses: paambaati/[email protected]
  env:
    CC_TEST_REPORTER_ID: YOUR_REPO_REPORTER_ID
  with:
    coverageCommand: coverage report

This will upload your report to code climate.

@paambaati is it possible to cover some more examples in the doc or README?

abhishekmishragithub avatar May 11 '21 19:05 abhishekmishragithub

@abhishekmishragithub I'd love it if you can send a PR for this!

paambaati avatar Sep 29 '21 13:09 paambaati

@paambaati for adding an example in README.md?

abhishekmishragithub avatar Oct 07 '21 05:10 abhishekmishragithub

for adding an example in README.md?

Yes.

paambaati avatar Oct 07 '21 06:10 paambaati

for adding an example in README.md?

Yes.

Sure. will do a tiny PR for it soon. Thanks ✌🏼

abhishekmishragithub avatar Oct 12 '21 04:10 abhishekmishragithub