Created
December 27, 2012 09:30
-
-
Save anonymous/4386894 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
SHOW_COVERAGE=0 | |
if [ "$1" == "-" ] | |
then | |
SHOW_COVERAGE=1 | |
app="" | |
else | |
app=$1 | |
fi | |
if [ "$2" == "-" ] | |
then | |
SHOW_COVERAGE=1 | |
fi | |
# Get package name | |
array_split=(${app//./ }) | |
cover_package=${array_split[0]} | |
cmd_line="--with-coverage --cover-html" | |
if [ "$cover_package" != "" ] | |
then | |
cmd_line="$cmd_line --cover-package=$cover_package" | |
fi | |
# Run tests | |
./manage.py test $app $cmd_line | |
RETVAL=$? | |
if [ $RETVAL -eq 0 ] | |
then | |
notify-send --urgency=critical --icon=info "All tests are passed" | |
else | |
notify-send --urgency=critical --icon=error "Some tests are failed" | |
fi | |
if [ $SHOW_COVERAGE -eq 1 ] | |
then | |
nohup gnome-open ./cover/index.html &> /dev/null | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment