aboutsummaryrefslogtreecommitdiff
blob: 8284ddd1c33b658e6be58e5909a632132ad6e95d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/bash

while getopts dcf2v: arg; do
    case ${arg} in
        d) TDAEMON="tdaemon -t django" ;;
        c) COVERAGE="coverage" ;;
        f) FLAKE8="flake8 . --exclude=./okupy/tests/settings.py,./okupy/settings,setup.py,.virtualenv" ;;
        2) SUFFIX="2" ;;
        v) VERBOSE="-v ${OPTARG}" ;;
    esac
done

ARGS="--settings=okupy.tests.settings --traceback ${VERBOSE}"

if [[ -n ${TDAEMON} ]]; then
    [[ -n ${COVERAGE} ]] && COVERAGE="-c"
    ${TDAEMON} ${COVERAGE} --custom-args="${ARGS} ${*:${OPTIND}}"
elif [[ -n ${COVERAGE} ]]; then
    ${COVERAGE} run manage.py test ${ARGS} "${@:${OPTIND}}"
    ${COVERAGE} report -m
else
    COMMAND="python${SUFFIX} manage.py test ${ARGS} ${*:${OPTIND}}"
    echo "Executing: $COMMAND"
    $COMMAND
fi

${FLAKE8}