-
Notifications
You must be signed in to change notification settings - Fork 72
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
Send pytest coverage reports to code climate #2198
Conversation
Code Climate has analyzed commit 01719d8 and detected 0 issues on this pull request. The test coverage on the diff in this pull request is 100.0% (50% is the threshold). This pull request will bring the total coverage in the repository to 71.0%. View more on Code Climate. |
At this point I've gotten the coverage reports writing out successfully, and am now toying with the proper CI syntax to get everything to upload One potential stumbling block is how to handle the fact that we only sometimes run the unsafe CI checks...I'm not sure yet if this will throw false positives about code coverage if those don't get run |
After some more testing and using this comment as an example, it appears to be an issue caused by running the tests within a docker file. Going to try some things locally such as setting a specific source file and seeing if that helps things |
I noticed that it was saying that |
after adding some custom logic in the last commit, I got a valid report uploaded, hopefully it works in CI as well EDIT: It broke in CI due to a file permissions error, will try fixes for that |
@sanders41 any idea on this error? It's a CI-specific one, and seems arbitrary |
The 3 most common reasons I have seen for this are:
|
It seems like writing to files from within the docker container is perfectly fine, but trying to do it Pythonically within the |
…in the docker container
The test reports are now working! https://codeclimate.com/repos/63be6d666de62000f3e44a88/settings/test_reports/63c7791b56b68a1d0b82b1a4 |
… coverage with less or more than 4 summed coverage results
The (for real this time though) final bug I've discovered is that the branch name in GitHub Actions is given as Due to this mismatch, the auto-updating code comment is not seeing what is actually happening in this PR and was instead only reflecting results from my local runs (where everything is working as intended) I will update the CI checks with hopefully the proper github action var and should be set |
Even though it matches in the UI, it doesn't appear to be working because the comment still isn't updating... I've decided to make #2180 it's own PR to tackle this directly and in a more direct way. This PR is stale and needs to get reviewed/merged before it balloons any more |
Closes #2179
Code Changes
pytest
session that calls the other test functionsisort(fix)
andblack(fix)
first so thatnox -s static_checks
will try to fix files before checking thempytest
CI checks from the general backend checks to streamline the jobs that upload code coverageCode Climate
in CI (CC Docs)Steps to Confirm
pytest
jobs produce and upload a coverage file (4 tests)Pre-Merge Checklist
CHANGELOG.md
Description Of Changes
Disclaimer: This change was meant to be relatively small, but in true "give a mouse a cookie" fashion it snow-balled into something much larger. Generally the changes are quite safe and is mostly all new functionality as opposed to modifying existing functionality.
Disclaimer 2: This change only handles uploading the coverage reports to
Code Climate
, there is still a bug preventing the code comment from updating on every push to the PR that will need to be solved in a PR for #2180This PR adds the functionality that allows for continual tracking of overall code coverage via a 3rd party. This required a lot of engineering in terms of CI/scripting and has also touched how tests are run via
nox
sessions.As a caveat, we are not including external test coverage as part of this work.
Nox changes
The
nox
suite of test sessions now looks like this:Everything has been converted to a single
pytest
session with individual testing groups as a parameter.