Skip to content

Commit

Permalink
Small fixes to the comment template
Browse files Browse the repository at this point in the history
  • Loading branch information
ewjoachim committed Jan 2, 2024
1 parent a921cba commit 775c60f
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 13 deletions.
16 changes: 9 additions & 7 deletions coverage_comment/template_files/comment.md.j2
Original file line number Diff line number Diff line change
Expand Up @@ -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 -%}
<details><summary>Click to see where and how coverage changed</summary><table><thead>
Expand Down Expand Up @@ -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 -%}
<sub>

This report was generated by [python-coverage-comment-action](https://github.com/py-cov-action/python-coverage-comment-action)

</sub>

{%- endblock footer -%}
</details>

{% endblock footer -%}

{%- endif -%}
{%- endblock coverage_by_file %}

{{ marker -}}
27 changes: 21 additions & 6 deletions tests/unit/test_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,16 @@ def test_template(coverage_obj, diff_coverage_obj):
<td align="center"><a href="https://github.com/org/repo/pull/5/files#diff-4b0bf2efa3367c0072ac2bf1e234e703dc46b47aaa4fe9d3b01737b1a15752b1"><img title="This PR adds 10 statements to the whole project. The file did not seem to exist on the base branch." src="https://img.shields.io/badge/10-%28%2B10%29-007ec6.svg"></a></td><td align="center"><a href="https://github.com/org/repo/pull/5/files#diff-4b0bf2efa3367c0072ac2bf1e234e703dc46b47aaa4fe9d3b01737b1a15752b1"><img title="This PR adds 4 statements missing coverage to the whole project. The file did not seem to exist on the base branch." src="https://img.shields.io/badge/4-%28%2B4%29-red.svg"></a></td><td align="center"><a href="https://github.com/org/repo/pull/5/files#diff-4b0bf2efa3367c0072ac2bf1e234e703dc46b47aaa4fe9d3b01737b1a15752b1"><img title="The coverage rate of the whole project is 60% (6/10). The file did not seem to exist on the base branch." src="https://img.shields.io/badge/60%25-%286/10%29-orange.svg"></a></td><td align="center"><a href="https://github.com/org/repo/pull/5/files#diff-4b0bf2efa3367c0072ac2bf1e234e703dc46b47aaa4fe9d3b01737b1a15752b1"><img title="In this PR, 4 new statements are added to the whole project, 2 of which are covered (50%)." src="https://img.shields.io/badge/50%25-%282/4%29-orange.svg"></a></td><td>&nbsp;</td>
</tr>
</tfoot>
</table><sub>
</table>
<sub>
This report was generated by [python-coverage-comment-action](https://github.com/py-cov-action/python-coverage-comment-action)
</sub></details>
</sub>
</details>
<!-- foo -->"""
assert result == expected
Expand Down Expand Up @@ -218,11 +223,16 @@ def test_template_full(make_coverage, make_coverage_and_diff):
<td align="center"><a href="https://github.com/org/repo/pull/12/files#diff-4b0bf2efa3367c0072ac2bf1e234e703dc46b47aaa4fe9d3b01737b1a15752b1"><img title="This PR adds 2 to the number of statements in the whole project, taking it from 19 to 21." src="https://img.shields.io/badge/21-%28%2B2%29-007ec6.svg"></a></td><td align="center"><a href="https://github.com/org/repo/pull/12/files#diff-4b0bf2efa3367c0072ac2bf1e234e703dc46b47aaa4fe9d3b01737b1a15752b1"><img title="This PR adds 1 to the number of statements missing coverage in the whole project, taking it from 3 to 4." src="https://img.shields.io/badge/4-%28%2B1%29-red.svg"></a></td><td align="center"><a href="https://github.com/org/repo/pull/12/files#diff-4b0bf2efa3367c0072ac2bf1e234e703dc46b47aaa4fe9d3b01737b1a15752b1"><img title="This PR removes 3.26 percentage points from the coverage rate in the whole project, taking it from 84.21% (16/19) to 80.95% (17/21)." src="https://img.shields.io/badge/80%25-%2816/19%20%3E%2017/21%29-red.svg"></a></td><td align="center"><a href="https://github.com/org/repo/pull/12/files#diff-4b0bf2efa3367c0072ac2bf1e234e703dc46b47aaa4fe9d3b01737b1a15752b1"><img title="In this PR, 6 new statements are added to the whole project, 2 of which are covered (33.33%)." src="https://img.shields.io/badge/33%25-%282/6%29-red.svg"></a></td><td>&nbsp;</td>
</tr>
</tfoot>
</table><sub>
</table>
<sub>
This report was generated by [python-coverage-comment-action](https://github.com/py-cov-action/python-coverage-comment-action)
</sub></details>
</sub>
</details>
<!-- foo -->"""
print(result)
Expand Down Expand Up @@ -267,11 +277,16 @@ def test_template__no_previous(coverage_obj_no_branch, diff_coverage_obj):
<td align="center"><a href="https://github.com/org/repo/pull/3/files#diff-4b0bf2efa3367c0072ac2bf1e234e703dc46b47aaa4fe9d3b01737b1a15752b1"><img title="This PR adds 8 statements to the whole project. The file did not seem to exist on the base branch." src="https://img.shields.io/badge/8-%28%2B8%29-007ec6.svg"></a></td><td align="center"><a href="https://github.com/org/repo/pull/3/files#diff-4b0bf2efa3367c0072ac2bf1e234e703dc46b47aaa4fe9d3b01737b1a15752b1"><img title="This PR adds 4 statements missing coverage to the whole project. The file did not seem to exist on the base branch." src="https://img.shields.io/badge/4-%28%2B4%29-red.svg"></a></td><td align="center"><a href="https://github.com/org/repo/pull/3/files#diff-4b0bf2efa3367c0072ac2bf1e234e703dc46b47aaa4fe9d3b01737b1a15752b1"><img title="The coverage rate of the whole project is 50% (4/8). The file did not seem to exist on the base branch." src="https://img.shields.io/badge/50%25-%284/8%29-red.svg"></a></td><td align="center"><a href="https://github.com/org/repo/pull/3/files#diff-4b0bf2efa3367c0072ac2bf1e234e703dc46b47aaa4fe9d3b01737b1a15752b1"><img title="In this PR, 4 new statements are added to the whole project, 2 of which are covered (50%)." src="https://img.shields.io/badge/50%25-%282/4%29-red.svg"></a></td><td>&nbsp;</td>
</tr>
</tfoot>
</table><sub>
</table>
<sub>
This report was generated by [python-coverage-comment-action](https://github.com/py-cov-action/python-coverage-comment-action)
</sub></details>
</sub>
</details>
<!-- foo -->"""
print(result)
Expand Down

0 comments on commit 775c60f

Please sign in to comment.