-
Notifications
You must be signed in to change notification settings - Fork 34
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
Use the Original percent_covered
#361
Use the Original percent_covered
#361
Conversation
Admin commands cheatsheet:
|
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
percent_covered
percent_covered
Hey, thanks for the contribution. Can you expand a bit on why this is something we want to do ? |
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 Thanks for asking. For example, python-coverage-comment-action/coverage_comment/coverage.py Lines 216 to 218 in ab22836
As the result, even if we calculate the coverage using branch measurement (e.g., |
If we add it back, it might be better to add it back fully with documentation, see #336 . We also may want to adapt the markdown table to display proper values. Also, if possible, I'd rather we do the calculation ourselves every time rather than sometimes doing it and sometimes depending on the data having done it for us. I'm not saying that it's currently the case, and we might fix it, but if we're going towards one side of this question, I'd rather it's the "side I consider the most correct as of now": computing the coverage rate ourselves, potentially taking into account branching to get the correct value. (I also have #347 in mind and I think it may be interesting to avoid expanding our tight coupling with Coverage just yet) |
Hello @ewjoachim! Can you tell me what action I should take in this PR? |
Well, it's mainly that discussing the issue before jumping into the code might have been an easier way to set everyone's expectations straight. I think it might be more work than what was here so far. Of course if you want to tackle it, it's very nice, but I also understand if you'd rather not. From the top of my head, here's how I imagine the things to look like:
Also, when you're done, please consider rebasing your commits into separate parts of work to ease commit-by-commit reviewing. That said, this part is optional. |
@ewjoachim Hello, thanks for the detailed guidelines. There is one thing I would like to ask before I start doing this. If I follow your guide, the coverage rate is calculated by We run a test before doing this $ pytest --cov src
---------- coverage: platform linux, python 3.11.7-final-0 -----------
Name Stmts Miss Branch BrPart Cover Missing
---------------------------------------------------------------------------------------------------------
src/.../__init__.py 3 0 0 0 100.00%
src/.../__main__.py 7 7 2 0 0.00% 2-14
...
---------------------------------------------------------------------------------------------------------
TOTAL 2180 1154 886 75 42.04% As shown above, we have already obtained a coverage rate of 42.04%, and this value is stored in Before I proceed, I'd like to ask why we can't just use |
Issues like #370 and #347 are making me wary of adding more tight coupling between this lib and Coverage. I try to be mindful of the choices we make consuming (or not consuming) features from our dependencies so that we stay in control and when we want to make a change, we somewhat limit the risk. It's pretty obvious that whatever tool we'll use, we'll need to have the raw data. But will the tool also provide the totals ? I don't know. If we compute the totals ourselves, this is not a question we need to ask. |
@ewjoachim I agree with your point. Unfortunately, I am afraid that I cannot continue what you requested in #361 (comment). 😢 Please close this PR if you want. |
I understand, and I'm sorry too. Thanks for your contribution anyways. Please note that it's not fun from my side either to decide whether contributions are accepted or not, especially when the answer isn't positive, and especially in cases like this where it really is a question of gut feeling, and not of quality or anything. I think I'll close the PR, but I'll open an issue for properly dealing with branch coverage. (If the situation evolves, I might reopen and merge at some point) |
We can use the original
percent_covered
instead of recalculating it.