Skip to content

Instantly share code, notes, and snippets.

@dzlab
Created August 29, 2012 18:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dzlab/3517132 to your computer and use it in GitHub Desktop.
Save dzlab/3517132 to your computer and use it in GitHub Desktop.
A python script for coverage testing, it takes a unit test case as a parameter
#!/bin/sh -e
err() { echo 1>&2 "$@"; exit 1; }
[ -n "$1" -a -z "$2" ] || err 'Usage: cover <filename>'
[ -r "$1" ] || err "Cannot read $1."
coverage erase || err 'Cannot run coverage.'
coverage run "$1"
rm -rf htmlcov
coverage html
xdg-open htmlcov/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment