forked from tildaslash/RatticWeb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
runtests.sh
executable file
·62 lines (52 loc) · 1.32 KB
/
runtests.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
#!/bin/bash
# Pretty script to run the tests included. Should be run before
# you commit anything. They get run in Travis-CI anyway, so this
# just helps you avoid looking like a fool.
lint_only=0
tests_only=0
unit_test_args=""
unit_test_command="./manage.py test"
for var in $@; do
case $var in
"--tests-only")
tests_only=1
;;
"--lint-only")
lint_only=1
;;
"--without-selenium")
unit_test_command="$unit_test_command --tc=no_selenium:true"
;;
"--nose-help")
unit_test_command="$unit_test_command --help"
tests_only=1
;;
"--help")
echo "./runtests [--tests-only] [--without-selenium] [--help] [--nose-help]"
exit 0
;;
*)
unit_test_args="$unit_test_args $var"
;;
esac
done
function runtest() {
name="$1"
command="$2"
echo -n "Running $name ($command)... "
ENABLE_TESTS=1 $command
if [ $? -eq 0 ]; then
echo 'Success'
else
echo 'Failure'
exit 1
fi
}
if (( $tests_only == 0 )); then
runtest "PEP8" "pep8 --exclude=migrations,lib,static,.ropeproject --ignore=E501,E225,E128,E124 ."
runtest "pyflakes" "./pyflakes.sh"
fi
if (( $lint_only == 0 )); then
runtest "Unit Tests" "$unit_test_command $unit_test_args"
fi
exit 0