⚠️ coverage-badge is in maintenance mode. I might still do occasional updates and fixes from time to time, but there will be no added features. Most people using coverage-badge might want to use genbadge instead, which has more features (e.g. test badges, flake8 reports, etc).
A small script to generate coverage badges using Coverage.py.
The badge template has been taken from shields.io, therefore it should look mostly good. (The spec is a bit stricter on the margins, but I can't easily do text width calculations in Python so the margins might not always be 4px.)
Run:
pip install coverage-badge
First, run Coverage.py to generate the necessary coverage data. Then you can either return the badge SVG to stdout:
$ coverage-badge
...or write it to a file:
$ coverage-badge -o coverage.svg
It's important that you run coverage-badge
from the directory where the
.coverage
data file is located.
Different colors for cover ranges:
The full usage text:
usage: __main__.py [-h] [-o FILEPATH] [-p] [-f] [-q] [-v] Generate coverage badges for Coverage.py. optional arguments: -h, --help show this help message and exit -o FILEPATH Save the file to the specified path. -p Plain color mode. Standard green badge. -f Force overwrite image, use with -o key. -q Don't output any non-error messages. -v Show version.
MIT License, see LICENSE.txt file..