X-Git-Url: https://wannabe.guru.org/gitweb/?a=blobdiff_plain;f=tests%2Frun_tests.sh;h=6255a69572bb2d232ea35955d8607269049ce392;hb=94c8a54eadbf8552fa4d33dc349616d125e1a638;hp=7ab316c88151bd309c0160b60b394f60ef7b823a;hpb=0ae7375a650b06e303eb523a7ab47730ec7308a1;p=python_utils.git diff --git a/tests/run_tests.sh b/tests/run_tests.sh index 7ab316c..6255a69 100755 --- a/tests/run_tests.sh +++ b/tests/run_tests.sh @@ -8,6 +8,9 @@ UNITTEST=0 INTEGRATION=0 FAILURES=0 TESTS_RUN=0 +COVERAGE=0 +PERF_TESTS=("string_utils_test.py") + dup() { if [ $# -ne 2 ]; then @@ -28,7 +31,7 @@ make_header() { local title="$1" local title_len=${#title} title_len=$((title_len + 4)) - local width=76 + local width=70 local left=4 local right=$(($width-($title_len+$left))) local color="$2" @@ -118,10 +121,14 @@ fi if [ ${UNITTEST} -eq 1 ]; then for test in $(find ${ROOT} -name "*_test.py" -print); do BASE=$(basename ${test}) - BASE="${BASE} (unittest)" - make_header "${BASE}" "${GREEN}" + HDR="${BASE} (unittest)" + make_header "${HDR}" "${GREEN}" if [ ${COVERAGE} -eq 1 ]; then coverage run --source ${HOME}/lib --append ${test} --unittests_ignore_perf + if [[ " ${PERF_TESTS[*]} " =~ " ${BASE} " ]]; then + echo "(re-running w/o coverage to record perf results)." + ${test} + fi else ${test} fi @@ -136,8 +143,8 @@ fi if [ ${INTEGRATION} -eq 1 ]; then for test in $(find ${ROOT} -name "*_itest.py" -print); do BASE=$(basename ${test}) - BASE="${BASE} (integration test)" - make_header "${BASE}" "${ORANGE}" + HDR="${BASE} (integration test)" + make_header "${HDR}" "${ORANGE}" if [ ${COVERAGE} -eq 1 ]; then coverage run --source ${HOME}/lib --append ${test} else @@ -153,11 +160,16 @@ fi if [ ${COVERAGE} -eq 1 ]; then make_header "Code Coverage Report" "${GREEN}" - coverage report --omit=config-3.8.py --sort=-cover + coverage report --omit=config-3.8.py,*_test.py --sort=-cover + echo + echo "To recall this report w/o run-running the tests:" + echo + echo " $ coverage report --omit=config-3.8.py,*_test.py --sort=-cover" echo - echo "Note: to recall this report without run-running the tests, invoke:" + echo "...from the 'tests' directory. Note that subsequent calls to " + echo "run_tests.sh with --coverage will klobber previous results. See:" echo - echo " $ coverage report --omit=config-3.8.py --sort=-cover" + echo " https://coverage.readthedocs.io/en/6.2/" echo fi