-
Notifications
You must be signed in to change notification settings - Fork 32
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
Branch coverage #466
Branch coverage #466
Conversation
Admin commands cheatsheet:
|
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
You're right. It's extremely annoying to run e2e tests for external contributors, and it's perfectly ok to wait for maintainers to launch them. Sadly, we need to use 2 github accounts to run those, but, at least, they provide a real-world test that's much better to trust the changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll dig a bit but I'm surprised we don't need to update the template.
For now, very nice start.
Feel free to say if you have some feedback on the codebase & contribution process, especially if you saw things that were improvable, confusing, concerning etc. Of course, this applies to the next steps of your contribution too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/e2e
(approving just to run the e2e tests for now)
That was precisely my reaction as well, at which point I went: "Maybe I'm overthinking it. Even with branches, lines in the diff are either covered or not, right?" I don't actually know if that IS right, but I figured I'd run with it and see how it goes. #YOLO |
The e2e tests ran here producing:
|
Do we need to update some of the numbers & wording in the template ? |
So just to follow:
|
That's a good question — there was one spot where, in the Regarding other changes, obviously things like the unit test addition and any template changes would be new commits, but for adjustments to existing changes (like the |
@ewjoachim Oh, also, can I get an invite to the private e2e repo? |
Oh, interesting ! It should have been done automatically and it didn't Looks like it's because Let's fix it (in another PR) |
TL;DR: as you wish, I don't have strong opinions. But I appreciate discussing it and get to know what you prefer. Glad you asked ! It sounds like you might be introduced to the wonderful When you wish to modify a commit but don't want to hinder reviewability, make the changes that would supposedly go in a commit and commit them with When everything has been reviewed and you're ready to merge, use Of course, there are also cons to this approach (some of which are shared with other solutions):
Note I mentioned force pushing, and I'm contractually required to mention using |
Let's retry after the fix. /invite |
You should have received the invitation :) |
Finally had a chance to return to this. Not complete yet, but changes so far:
(Edit: Unit tests added.) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems awesome so far :)
@ewjoachim Could you please fire off another run of the end-to-end tests? I want to get a look at the current comment templates' output in rendered form. Reading it in encoded form in string variables inside the tests is... less-than-enlightening. |
Wooops totally missed that ! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/e2e
@ewjoachim No worries, I don't know why I asked for it — the current e2e tests don't really show any of the branch coverage features, because they don't include any code changes (just coverage changes). I was thinking of submitting a (separate) PR that adds an actual code modification to the e2e tests, so that we could get a look at the diff coverage reporting as well. That's the part, if anything, that I think might need adjusting with branch coverage enabled. (I figured I'd drop the test-ed function to just contain def f(a="", b="", c="", d=""):
elements = []
if a:
elements.append(a)
if b:
elements.append(b)
"""__ADD_CODE_HERE__"""
return "-".join(elements) ...And then have the e2e test function insert the WDYT? |
Good idea :) |
Hey what would you say that:
Deal ? |
@ewjoachim Sure, that works for me. There's nothing that can't be cleaned up in a future PR. |
Sorry for the delay. I'm all over the place these days. Congratulations for you contribution! |
This PR builds on @ewjoachim 's WIP #413, completing the changes and updating the relevant tests so that all tests pass successfully when run locally with
poetry run pytest
. The pre-commit hooks were also run on all commits, and any ruff changes incorporated. I have not, however, run the E2E tests; I figured that could wait until after the PR was opened.The PR branch contains four commits, the first being @ewjoachim's WIP changes to
coverage_comment.coverage
. The second commit is my own changes to complete the branch-coverage support.A single new unit test,
test_compute_coverage_with_branches
, is added totests/unit/test_coverage.py
in the third commit, to exercise the updatedcoverage_comment.coverage.compute_coverage
functionality in cases where (non-zero) branch coverage values are included.The fourth commit adjusts the
conftest.py
fixtures and the various tests intest_template.py
to both supply and expect coverage data computed accounting for branch coverage, raising the actual coverage for the fixture(s) data from 60% to53.84%62.5%.I'll add a bit of commentary on specific changes as review comments, so they're easier to discuss in the proper context.