File: genbadge

package info (click to toggle)
manuel 1.13.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 376 kB
  • sloc: python: 864; makefile: 154; sh: 2
file content (24 lines) | stat: -rw-r--r-- 778 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
"""This is a hack to get the coverage percentage reported in whole numbers."""
import re
import sys
from genbadge import utils_coverage
from genbadge import utils_badge

def my_get_coverage_badge(cov_stats):
    """Generate a coverage badge they way I like it.

    The original included two decimal places in the percentage.
    I just want an integer percentage.
    """

    color = utils_coverage.get_color(cov_stats)
    right_txt = '%.0f%%' % (cov_stats.total_coverage,)
    return utils_badge.Badge(left_txt="coverage", right_txt=right_txt, color=color)

utils_coverage.get_coverage_badge = my_get_coverage_badge

import genbadge.main

if __name__ == '__main__':
    sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
    sys.exit(genbadge.main.genbadge())