From 775c60f463923d6e7ac2d42fc501da85f1471871 Mon Sep 17 00:00:00 2001 From: Joachim Jablon Date: Tue, 2 Jan 2024 10:47:02 +0100 Subject: [PATCH] Small fixes to the comment template --- coverage_comment/template_files/comment.md.j2 | 16 ++++++----- tests/unit/test_template.py | 27 ++++++++++++++----- 2 files changed, 30 insertions(+), 13 deletions(-) diff --git a/coverage_comment/template_files/comment.md.j2 b/coverage_comment/template_files/comment.md.j2 index 650ade22..518a3186 100644 --- a/coverage_comment/template_files/comment.md.j2 +++ b/coverage_comment/template_files/comment.md.j2 @@ -109,7 +109,8 @@ {# Individual file report #} {%- block coverage_by_file -%} -{%- if not files -%} +{%- if not files %} + _This PR does not seem to contain any modification to coverable code._ {%- else -%}
Click to see where and how coverage changed @@ -246,19 +247,20 @@ _This PR does not seem to contain any modification to coverable code._ > [!NOTE] > The report is truncated to {{ max_files }} files out of {{ count_files }}. To see the full report, please visit the workflow summary page. -{% endif -%} +{% endif %} -{%- endif -%} -{%- endblock coverage_by_file -%} +{%- block footer %} -{%- block footer -%} This report was generated by [python-coverage-comment-action](https://github.com/py-cov-action/python-coverage-comment-action) - -{%- endblock footer -%} +{% endblock footer -%} + +{%- endif -%} +{%- endblock coverage_by_file %} + {{ marker -}} diff --git a/tests/unit/test_template.py b/tests/unit/test_template.py index c9ebd89d..51880ec2 100644 --- a/tests/unit/test_template.py +++ b/tests/unit/test_template.py @@ -92,11 +92,16 @@ def test_template(coverage_obj, diff_coverage_obj): -
 
+ + + This report was generated by [python-coverage-comment-action](https://github.com/py-cov-action/python-coverage-comment-action) -
+ + + + """ assert result == expected @@ -218,11 +223,16 @@ def test_template_full(make_coverage, make_coverage_and_diff):   - + + + This report was generated by [python-coverage-comment-action](https://github.com/py-cov-action/python-coverage-comment-action) - + + + + """ print(result) @@ -267,11 +277,16 @@ def test_template__no_previous(coverage_obj_no_branch, diff_coverage_obj):   - + + + This report was generated by [python-coverage-comment-action](https://github.com/py-cov-action/python-coverage-comment-action) - + + + + """ print(result)