Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python coverage badges, how to get them?

I am using Python coverage to test my apps. Looking at other developers on GitHub I see they have a small badge which shows the percentage of coverage. Using coverage, how can I generate these badges?

The coverage badge is the one I'm looking at below.

badges

Update: There are packages that generate badges i.e. nose-htmloutput! Cool

like image 445
Prometheus Avatar asked Mar 27 '15 08:03

Prometheus


1 Answers

You can click on those badges and it'll generally take you to the service that provides them.

The coverage badge is provided by https://coveralls.io/:

Coveralls is a web service to help you track your code coverage over time, and ensure that all your new code is fully covered.

There is but one prerequisite:

  • Your code must be hosted on GitHub

Once you have signed up and included the required configuration and integrations or packages when developing, you are given a image URL to include in your project documentation; the python-coveralls project has:

.. image:: https://coveralls.io/repos/z4r/python-coveralls/badge.png?branch=master
    :target: https://coveralls.io/r/z4r/python-coveralls

in their README for example, which renders as:

1

like image 164
Martijn Pieters Avatar answered Oct 12 '22 03:10

Martijn Pieters