Skip to content
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

add summary comment #444

Merged
merged 3 commits into from
Jul 29, 2024
Merged

Conversation

tgehrs
Copy link
Contributor

@tgehrs tgehrs commented Jul 19, 2024

Fix for #442 to create a separate summary comment from the truncated PR comment

Copy link

End-to-end public repo

Admin commands cheatsheet:

  • /e2e (in approved PR review body): Trigger end-to-end tests on external contributions
  • /invite (in comment): Invite the author & admins to the end-to-end private repo

Copy link

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  coverage_comment
  main.py
Project Total  

This report was generated by python-coverage-comment-action

@ewjoachim
Copy link
Member

Can you look at existing tests and tell me if it's easy to add a new one for this case ?

@tgehrs
Copy link
Contributor Author

tgehrs commented Jul 22, 2024

From my reading of the tests, this one seems to confirm that this functionality should work. It seems that mocks are rarely used, so I'm not sure how else to verify that it is called with None for max_files. If you have a place in mind you would like me to add a test please let me know and I will gladly do my best.

def test_template__no_max_files(coverage_obj_more_files, diff_coverage_obj_more_files):
files, total = template.select_files(
coverage=coverage_obj_more_files,
diff_coverage=diff_coverage_obj_more_files,
previous_coverage=None,
max_files=25,
)
result = template.get_comment_markdown(
coverage=coverage_obj_more_files,
diff_coverage=diff_coverage_obj_more_files,
previous_coverage=None,
files=files,
count_files=total,
previous_coverage_rate=decimal.Decimal("0.92"),
minimum_green=decimal.Decimal("79"),
minimum_orange=decimal.Decimal("40"),
repo_name="org/repo",
pr_number=5,
max_files=None,
base_template=template.read_template_file("comment.md.j2"),
marker="<!-- foo -->",
subproject_id="foo",
custom_template="""{% extends "base" %}
{% block emoji_coverage_down %}:sob:{% endblock emoji_coverage_down %}
""",
)
print(result)
assert "The report is truncated" not in result
assert "code.py" in result
assert "other.py" in result

@ewjoachim
Copy link
Member

(Ah sorry, missed you message).

I agree with you, adding a test there will probably mean more mocks, and limited value. Let's go !

@ewjoachim ewjoachim merged commit 623c592 into py-cov-action:main Jul 29, 2024
3 checks passed
@ewjoachim
Copy link
Member

ewjoachim commented Jul 29, 2024

Released in https://github.com/py-cov-action/python-coverage-comment-action/releases/tag/v3.26 :)

Thank you very much for your contribution !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants