~ubuntu-branches/ubuntu/raring/django-classy-tags/raring

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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#!/bin/bash

args=("$@")
num_args=${#args[@]}
index=0

quicktest=false
disable_coverage=true

while [ "$index" -lt "$num_args" ]
do
case "${args[$index]}" in
        "--failfast")
            failfast="--failfast"
            ;;
         
        "--toxenv")
            let "index = $index + 1"
            toxenv="${args[$index]}"
            ;;
            
        "--quicktest")
            quicktest=true
            ;;
            
        "--help")
            echo ""
            echo "usage:"
            echo " runtests.sh"
            echo " or runtests.sh [testcase]"
            echo " or runtests.sh [flags] [testcase]"
            echo ""
            echo "flags:"
            echo " --toxenv [tox-env]"
            echo "    eg. runtests.sh --toxenv py26-1.2.X,py26-trunk"
            echo "    possible envs:"
            echo "        py25-1.2.X, py25-1.3.X, py25-trunk"
            echo "        py26-1.2.X, py26-1.3.X, py26-trunk"
            echo "        py27-1.2.X, py27-1.3.X, ALL"
            echo ""
            echo " --quicktest - use already built tox env, for running a simple test quickly"
            echo " --failfast - abort at first failing test"
            exit 1
            ;;
            
        *)
            suite="${args[$index]}"
    esac
let "index = $index + 1"
done



if [ ! "$toxenv" ]; then
    toxenv='py26-1.2.X'
fi

if [ "$failfast" ]; then
    echo "--failfast supplied, not using xmlrunner."
fi

if [ ! "$suite" ]; then
    echo "Running complete classytags testsuite."
else
    if [ $quicktest == false ]; then
        echo "Can only run specific suite with --quicktest"
        exit 1
    fi
    echo "Running classytags test $suite."
fi

if [ ! -f "toxinstall/bin/tox" ]; then
    echo "Installing tox"
    virtualenv toxinstall
    toxinstall/bin/pip install -U tox
fi

if [ $quicktest == true ]; then
    if [ "$toxenv" == "ALL" ]; then
        echo "Cannot use ALL with --quicktest" 
        exit 1
    fi
    IFS=","
    tenvs=( $toxenv )
    for tenv in ${tenvs[@]}; do
        if [ ! -d ".tox/$tenv" ]; then
            echo ".tox/$tenv does not exist, run without --quicktest first"
            exit 1
        fi
        # running tests without invoking tox to save time
        .tox/$tenv/bin/python classytags/test/run_tests.py --direct $failfast $suite 
        retcode=$?
    done
else
    toxinstall/bin/tox -e $toxenv
    retcode=$?
fi
exit $retcode