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

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

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

${FLAKE8}