-
Notifications
You must be signed in to change notification settings - Fork 0
/
tests.sh
executable file
·41 lines (31 loc) · 1.02 KB
/
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
#!/bin/bash
success_status_code=0
failure_status_code=1
red_color='\033[0;31m'
green_color='\033[0;32m'
no_color='\033[0m'
NAME_PROJECT=kabbage
echo 'Deleting .pyc files...'
find $NAME_PROJECT/ -name '*.pyc' -exec rm {} \;
echo 'Deleting backup files...'
find ./ -name '*~' -exec rm {} \;
echo 'Running source code analyzers...'
flake8 $NAME_PROJECT/
if [ $? -eq $success_status_code ]
then
echo "${green_color}No source code problems found${no_color}"
else
echo "${red_color}Source code problems found, please fix them to continue${no_color}"
exit $failure_status_code
fi
echo 'Running unit tests'
python $NAME_PROJECT/manage.py test $NAME_PROJECT/
if [ $? -eq $success_status_code ]
then
echo "${green_color}The tests ran successfully${no_color}"
else
echo "${red_color}The tests failed, please fix them to continue${no_color}"
exit $failure_status_code
fi
echo "${green_color}All tests ran successfully, now you can make a commit${red_color}"
exit $success_status_code