@@ -11,7 +11,7 @@ RED=$(tput bold && tput setaf 1)
1111GREEN=$( tput bold && tput setaf 2)
1212YELLOW=$( tput bold && tput setaf 3)
1313
14- printf " ${NORMAL} Shutting down docker-compose ..."
14+ printf " %sShutting down docker-compose ..." " ${NORMAL} "
1515
1616gc () {
1717 retval=$?
@@ -31,21 +31,23 @@ function start_gemini_service {
3131
3232start_gemini_service
3333
34- export PYTHONPATH=` pwd` /src
35- printf " ${NORMAL} Create Virtualenv for Python deps ..."
34+ PYTHONPATH=$( pwd) /src
35+ export PYTHONPATH
36+
37+ printf " %sCreate Virtualenv for Python deps ..." " ${NORMAL} "
3638
3739function prepare_venv() {
38- VIRTUALENV=` which virtualenv`
40+ VIRTUALENV=$( which virtualenv)
3941 if [ $? -eq 1 ]
4042 then
4143 # python34 which is in CentOS does not have virtualenv binary
42- VIRTUALENV=` which virtualenv-3`
44+ VIRTUALENV=$( which virtualenv-3)
4345 fi
4446
4547 ${VIRTUALENV} -p python3 venv && source venv/bin/activate
4648 if [ $? -ne 0 ]
4749 then
48- printf " ${RED} Python virtual environment can't be initialized${NORMAL} "
50+ printf " %sPython virtual environment can't be initialized%s " " ${RED} " " ${NORMAL} "
4951 exit 1
5052 fi
5153}
@@ -70,11 +72,13 @@ export BAYESIAN_JWT_AUDIENCE='a,b'
7072export BAYESIAN_FETCH_PUBLIC_KEY=' test'
7173
7274psql_conn_str=" postgres://${POSTGRESQL_USER} :${POSTGRESQL_PASSWORD} @${PGBOUNCER_SERVICE_HOST} :${5432} /${POSTGRESQL_DATABASE} "
73- for i in {1..60}; do
74- rc=` psql -q " ${psql_conn_str} " -c ' ' ; echo $? `
75+ for i in {1..60}
76+ do
77+ printf " %sWaiting for Postgres: %s/60 %s\n" " ${YELLOW} " " ${i} " " ${NORMAL} "
78+ rc=$( psql -q " ${psql_conn_str} " -c ' ' ; echo $? )
7579 [ " $rc " == " 0" ] && break
7680 sleep 1
77- done ;
81+ done
7882
7983echo " *****************************************"
8084echo " *** Cyclomatic complexity measurement ***"
@@ -89,7 +93,8 @@ radon mi -s -i venv .
8993echo " *****************************************"
9094echo " *** Unit tests ***"
9195echo " *****************************************"
92- python3 ` which pytest` --cov=src/ --cov-report term-missing -vv tests/
96+ python3 " $( which pytest) " --cov=src/ --cov-report term-missing --cov-fail-under=$COVERAGE_THRESHOLD -vv tests/
97+ printf " %stests passed%s\n\n" " ${GREEN} " " ${NORMAL} "
9398
9499# deactivate virtual env before deleting it
95100deactivate
0 commit comments