aboutsummaryrefslogtreecommitdiff
blob: 1ea3b7a01618f59a9266e064f04052d8073a77e2 (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 sdcf2 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}