Skip to content

Commit 07b92b7

Browse files
author
Samuzzal Choudhury
committed
Removed runtests conflict
1 parent f2202be commit 07b92b7

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

runtests.sh

100755100644
Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ RED=$(tput bold && tput setaf 1)
1111
GREEN=$(tput bold && tput setaf 2)
1212
YELLOW=$(tput bold && tput setaf 3)
1313

14-
printf "${NORMAL}Shutting down docker-compose ..."
14+
printf "%sShutting down docker-compose ..." "${NORMAL}"
1515

1616
gc() {
1717
retval=$?
@@ -31,21 +31,23 @@ function start_gemini_service {
3131

3232
start_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

3739
function 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'
7072
export BAYESIAN_FETCH_PUBLIC_KEY='test'
7173

7274
psql_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

7983
echo "*****************************************"
8084
echo "*** Cyclomatic complexity measurement ***"
@@ -89,7 +93,8 @@ radon mi -s -i venv .
8993
echo "*****************************************"
9094
echo "*** Unit tests ***"
9195
echo "*****************************************"
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
95100
deactivate

0 commit comments

Comments
 (0)