Skip to main content

Generate coverage badges for Coverage.py.

Project description

Build status PyPI Downloads

⚠️ 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.

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

coverage-badge-1.1.1.tar.gz (5.6 kB view details)

Uploaded Source

Built Distribution

coverage_badge-1.1.1-py2.py3-none-any.whl (6.5 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file coverage-badge-1.1.1.tar.gz.

File metadata

  • Download URL: coverage-badge-1.1.1.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.8

File hashes

Hashes for coverage-badge-1.1.1.tar.gz
Algorithm Hash digest
SHA256 42252df917404af6147380861228a4ace3d9a29804df8fc2d34a22b2bc4f45b6
MD5 b602f6975dc0d3a75a71548a963f8273
BLAKE2b-256 e9356f215857207371618275463f1f08ca0221fbd2969d83081fe3f3918f709f

See more details on using hashes here.

File details

Details for the file coverage_badge-1.1.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for coverage_badge-1.1.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 1d8e566ad47c37910fa2bbc74ea19972b171b5b4e40624b31b3e2f2d93680266
MD5 be4bcb5e66f5d61cf6d72540964f77e2
BLAKE2b-256 dcce169c449301104186189b47d66e3eb0ee267273f22aaab185e0ec46591938

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page