This repository was archived by the owner on Jul 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathruntest.sh
More file actions
executable file
·68 lines (64 loc) · 1.9 KB
/
runtest.sh
File metadata and controls
executable file
·68 lines (64 loc) · 1.9 KB
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
SECONDS=0
unittest=false
flake8=false
testcase=false
clean=false
if [ $# -eq 0 ]; then
flake8=true
unittest=true
else
for argval in "$@"
do
if [ "$argval" == "clean" ]; then
clean=true
fi
if [ "$argval" == "flake8" ]; then
flake8=true
fi
if [ "$argval" == "unit" ] || [ "$argval" == "unittest" ]; then
unittest=true
fi
if [ "$argval" == "all" ]; then
unittest=true
flake8=true
fi
if [ "$argval" == "case" ]; then
testcase=true
fi
if [ "$testcase" = true ] && [[ "$argval" =~ ^tests.* ]]; then
label=$argval
fi
done
fi
if [ "$flake8" = true ]; then
echo "# checking flake8..."
if flake8 --jobs=auto; then
echo "OK\n"
fi
fi
if [ "$clean" = true ]; then
echo "# running unittests with clean db..."
python manage.py test --noinput --settings=tests.test_settings
fi
if [ "$unittest" = true ]; then
echo "# running unittests..."
python manage.py test --keepdb --settings=tests.test_settings
fi
if [ "$testcase" = true ]; then
echo "# running specific case $label..."
python manage.py test --keepdb --settings=tests.test_settings $label --debug-mode
fi
if [ "$clean" = false ] && [ "$flake8" = false ] && [ "$unittest" = false ] && [ "$testcase" = false ]; then
echo "Usage: ./runtest.sh [options] ..."
echo "* run all tests if no options provided"
echo "\nOptions:"
echo "flake8\t\t\t run flake8 only"
echo "unit, unittest\t\t run unit test only"
echo "case [case name]\t run a specific unit test in debug-mode"
echo " - example of case name\t [tests.accounts.test_login.LoginTest]"
echo "all\t\t\t run both flake8 and unit test"
echo "clean\t\t\t run unit test without --keepdb option"
else
duration=$SECONDS
echo "# test finished in $duration seconds."
fi