-
Notifications
You must be signed in to change notification settings - Fork 33
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
feat: create annotate only from diff coverage #188
Conversation
End-to-end public repo |
A few type issues were caught by pyright that mypy seems to have missed - I've chosen to ignore them for now, but do recommend pyright over mypy 👍 https://github.com/microsoft/pyright/blob/main/docs/mypy-comparison.md |
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.
Thank you for the PR :) That looks pretty good
I'm not used to Jinja and doing web-mocking in Python, so unsure how to fix those test errors :-)
One of the tests that is not successful is simply because the output here has changed because line 6 is not part of the DiffCoverage
, but part of the original codebase. So that actually proves that the changes work 😄
tests/unit/test_annotations.py
Outdated
def test_annotations_several_files(coverage_obj_many_missing_lines, capsys): | ||
def test_annotations_several_files(diff_coverage_obj, capsys): | ||
annotations.create_pr_annotations( | ||
annotation_type="notice", coverage=coverage_obj_many_missing_lines | ||
annotation_type="notice", coverage=diff_coverage_obj | ||
) | ||
|
||
expected = """::group::Annotations of lines with missing coverage | ||
::notice file=codebase/main.py,line=3::This line has no coverage | ||
::notice file=codebase/main.py,line=7::This line has no coverage | ||
::notice file=codebase/main.py,line=13::This line has no coverage | ||
::notice file=codebase/main.py,line=21::This line has no coverage | ||
::notice file=codebase/main.py,line=123::This line has no coverage | ||
::notice file=codebase/caller.py,line=13::This line has no coverage | ||
::notice file=codebase/caller.py,line=21::This line has no coverage | ||
::notice file=codebase/caller.py,line=212::This line has no coverage | ||
::notice file=codebase/code.py,line=7::This line has no coverage | ||
::notice file=codebase/code.py,line=9::This line has no coverage |
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.
With these changes, the two tests in the file are now exactly the same (except for the annotation type). Actually, the point was that the second test uses a fixture with more missing lines in several files. This is what coverage_obj_many_missing_lines
was for. Would it be possible to rework this fixture to return a DiffCoverage
object so that the test still serves its original function?
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.
Ah yeah, that's an excellent point. Is there any reason that the n_lines>2 case is different from the n_lines==2 case in the other test in the file? I've removed it for now, let me know if it's required.
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.
Is there any reason that the n_lines>2 case is different from the n_lines==2 case in the other test in the file?
This test is mainly for testing a bit more extensively (more files, more missing lines, more edge cases). I have committed a suggestion how I would imagine this.
Identical to prior tests
for more information, see https://pre-commit.ci
Thanks for an excellent review experience, @kieferro! I'm still not quite sure how My understanding is that the integration test environment is setup in
Let me know what you guys think, and feel free to commit to it as well 👍 |
for more information, see https://pre-commit.ci
These are actually not files, just variables created in if os.environ.get("A"):
1
if os.environ.get("B"):
2
if os.environ.get("C"):
3 And the creation of I hope that was understandable. If not, feel free to ask, I'm always happy to support with explanations (or code) 😃
Thanks 👍, I have added two commits with small changes. |
Good ! I have some changes I drafted but haven't posted yet on changing the integration fixture so that there is some diff coverage lines missing in the general case (changes the 77% figure in quite a few different test). I guess the best course of action would be to merge as is (when tests pass) and I'll do a follow-up PR with new tests, so as not to delay this too much. |
Coverage reportThe coverage rate went from
Diff Coverage details (click to unfold)coverage_comment/main.py
coverage_comment/coverage.py
coverage_comment/annotations.py
coverage_comment/settings.py
|
Congratulations on your first PR here ! Thank you very much :) |
@MartinBernstorff Unfortunately I had to revert this PR as a quickfix, because it caused the action to not work properly (#192). |
Tried my hand here! A few challenges remain, mainly that I'm not used to Jinja and doing web-mocking in Python, so unsure how to fix those test errors :-)