Switch branches/tags
Nothing to show
Find file Copy path
cb47fac Aug 10, 2013
1 contributor

Users who have contributed to this file

79 lines (48 sloc) 1.59 KB

How To Use With Unittest

This is adapted from: *

Install It

First, install

pip install coverage

Gather Data

Run your test suite, but replace python blah blah with coverage blah blah and specify a source directory.

For example:

coverage run --source cookiecutter test

Ideally your tests should be outside of your source directory, so that you don't have to configure excludes or package them. It's much neater that way.

Print Coverage Reports

Command-Line Report

To print a quick command line report, maximize your command prompt and type:

coverage report -m

HTML Report

To print a fancier HTML report:

coverage html
open html_cov/index.html

Set Up Coveralls

Sign up for with your GitHub account. Click [Add Repo] and add the repo for which you want a badge.

Here you'll use coveralls-python.

Add this to .travis.yml in the corresponding spots:

 - pip install coveralls

# change from 'script: python test' to this
script: coverage run --source cookiecutter test


Then when you push, after Travis finishes building, check your Coveralls account for the results.