forked from Karaage-Cluster/karaage
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathrun_tests.sh
executable file
·78 lines (67 loc) · 1.9 KB
/
run_tests.sh
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
#!/bin/bash
DIR=$(cd -P -- "$(dirname -- "$0")" && pwd -P)
FLAKE=0
RETURN=0
cd $DIR
if [ -n "$*" ]; then
TESTS="$@"
else
TESTS="karaage.tests.settings:karaage.tests
karaage.plugins.kgapplications.tests.settings:karaage.plugins.kgapplications
karaage.plugins.kgsoftware.tests.settings:karaage.plugins.kgsoftware.tests
karaage.plugins.kgsoftware.applications.tests.settings:karaage.plugins.kgsoftware
karaage.plugins.kgusage.tests.settings:karaage.plugins.kgusage"
fi
echo ""
echo "FLAKE8"
echo "############################"
flake8 --ignore=E501 --filename="south_migrations" .
flake8 --ignore=E501 --filename="migrations" .
flake8 --exclude="south_migrations,migrations" .
if [ ! $? -eq 0 ]
then
FLAKE=1
fi
echo -e "\n\n"
for values in $TESTS; do
conf=$(echo $values | cut -f1 -d:)
tests=$(echo $values | cut -f2 -d: | sed 's/,/ /g')
echo ""
echo "STATIC FILES - $conf"
echo "############################"
rm -rf tmp
./manage.py collectstatic --settings="$conf" -v 2 --noinput
if [ "$?" -ne 0 ]
then
exit 1
fi
echo ""
echo "TESTS - Python 2 - $conf - $tests"
echo "############################"
python2 ./manage.py test --settings="$conf" -v 2 $tests
if [ "$?" -ne 0 ]
then
RETURN=1
fi
# FIXME: ugly hack because Python3 django celery not in wheezy
if [ "$conf" != "karaage.plugins.kgusage.tests.settings" ]
then
echo ""
echo "TESTS - Python 3 - $conf - $tests"
echo "############################"
python3 ./manage.py test --settings="$conf" -v 2 $tests
if [ "$?" -ne 0 ]
then
RETURN=1
fi
fi
if [ "$RETURN" -ne 0 ]; then
echo "ERROR: Some tests failed for $values" >&2
exit "$RETURN"
fi
done
if [ "$FLAKE" -ne 0 ]; then
echo "ERROR: flake8 tests failed" >&2
exit "$FLAKE"
fi
exit "$RETURN"