aboutsummaryrefslogtreecommitdiff
blob: 0825325a3a3e71f4403b791e7b365e802e46e8f5 (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
#!/bin/bash

while getopts dcf2 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" ;;
    esac
done

ARGS="--settings=okupy.tests.settings --traceback"

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}