From 983d6724faeb3fc65aaa24089a763db9df80446b Mon Sep 17 00:00:00 2001 From: Chris Caron Date: Sun, 3 Apr 2022 13:29:34 -0400 Subject: [PATCH] Added filter to testing checkdone.sh script --- bin/checkdone.sh | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/bin/checkdone.sh b/bin/checkdone.sh index 17777eb9..ad4cb6e2 100755 --- a/bin/checkdone.sh +++ b/bin/checkdone.sh @@ -28,15 +28,18 @@ SCRIPT=$(readlink -f "$0") # Absolute path this script is in, thus /home/user/bin SCRIPTPATH=$(dirname "$SCRIPT") +PYTHONPATH="" + FOUNDROOT=1 if [ -f "$(dirname $SCRIPTPATH)/setup.cfg" ]; then pushd "$(dirname $SCRIPTPATH)" &>/dev/null FOUNDROOT=$? + PYTHONPATH="$(dirname $SCRIPTPATH)" elif [ -f "$SCRIPTPATH/setup.cfg" ]; then pushd "$SCRIPTPATH" &>/dev/null FOUNDROOT=$? - + PYTHONPATH="$SCRIPTPATH" fi if [ $FOUNDROOT -ne 0 ]; then @@ -59,7 +62,7 @@ which coverage &>/dev/null exit 1 echo "Performing PEP8 check..." -flake8 . --show-source --statistics +LANG=C.UTF-8 PYTHONPATH=$PYTHONPATH flake8 . --show-source --statistics if [ $? -ne 0 ]; then echo "PEP8 check failed" exit 1 @@ -69,11 +72,20 @@ echo # Run our unit test coverage check echo "Running test coverage check..." -coverage run -m pytest -vv -if [ $? -ne 0 ]; then +pushd $PYTHONPATH &>/dev/null +if [ ! -z "$@" ]; then + LANG=C.UTF-8 PYTHONPATH=$PYTHONPATH coverage run -m pytest -vv -k "$@" + RET=$? + +else + LANG=C.UTF-8 PYTHONPATH=$PYTHONPATH coverage run -m pytest -vv + RET=$? +fi + +if [ $RET -ne 0 ]; then echo "Tests failed." exit 1 fi # Print our report -coverage report --show-missing +LANG=C.UTF-8 PYTHONPATH=$PYTHONPATH coverage report --show-missing