Skip to content

Create badges/shields for your Python test coverage!

License

Notifications You must be signed in to change notification settings

kaleming/coverage-badge

This branch is 37 commits behind dbrgn/coverage-badge:main.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

4ca2734 · Mar 25, 2021

History

39 Commits
Mar 29, 2019
Nov 29, 2016
Nov 29, 2016
Mar 29, 2019
Mar 25, 2021
Jun 24, 2020
Jun 24, 2020
Mar 25, 2021
Mar 29, 2019
Nov 28, 2016
Mar 29, 2019
Oct 13, 2015
Nov 29, 2016
Mar 29, 2019

Repository files navigation

Coverage.py Badge

Build status PyPI Downloads

A small script to generate coverage badges using Coverage.py. Example of a generated badge:

Example coverage badge

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.)

Installation

Run:

pip install coverage-badge

Usage

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:

15%

45%

65%

80%

93%

97%


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.

License

MIT License, see LICENSE.txt file..

About

Create badges/shields for your Python test coverage!

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 100.0%