-
Notifications
You must be signed in to change notification settings - Fork 41
/
Copy pathrun-tests
executable file
·42 lines (33 loc) · 936 Bytes
/
run-tests
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
#!/bin/bash
EXIT_CODE=0
cd $(dirname "$BASH_SOURCE")
update_exit_code() {
LAST_EXIT_CODE=$?
if [ $LAST_EXIT_CODE != 0 ]
then
EXIT_CODE=$LAST_EXIT_CODE
fi
}
TEST_SETTINGS_MODULES=(
'pombola.settings.tests'
'pombola.settings.tests_kenya'
'pombola.settings.tests_nigeria'
'pombola.settings.tests_south_africa'
)
for TEST_SETTINGS_MODULE in "${TEST_SETTINGS_MODULES[@]}"
do
COMMAND="./manage.py test --settings=$TEST_SETTINGS_MODULE"
echo Running: $COMMAND "$@"
$COMMAND "$@"
update_exit_code
done
# If any test failed, make sure we output an error message in red at
# the end of the test run, just in case the test failures from the
# core tests went off the top of the terminal:
if [ $EXIT_CODE != 0 ]
then
echo "$(tput setaf 1)Tests failed.$(tput sgr0)"
fi
# And now exit with 0 if all tests succeeded, or otherwise with the
# last non-zero exit code:
exit $EXIT_CODE