This repository has been archived by the owner on Aug 28, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_tests.sh
executable file
·76 lines (62 loc) · 1.86 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
#!/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 "############################"
find -path "karaage/*/south_migrations/*.py" -print0 | xargs -0 flake8 --ignore=E501
if [ ! $? -eq 0 ]; then FLAKE=1; fi
find -path "karaage/*/migrations/*.py" -print0 | xargs -0 flake8 --ignore=E501
if [ ! $? -eq 0 ]; then FLAKE=1; fi
flake8 --exclude="south_migrations,migrations,.tox" .
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
echo ""
echo "TESTS - Python 3 - $conf - $tests"
echo "############################"
python3 ./manage.py test --settings="$conf" -v 2 $tests
if [ "$?" -ne 0 ]
then
RETURN=1
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"