From: Scott Gasch Date: Thu, 23 Sep 2021 16:40:48 +0000 (-0700) Subject: Fixup argparse_utils' doctest and tweak test runner. X-Git-Url: https://wannabe.guru.org/gitweb/?a=commitdiff_plain;h=4a65828d3cabb98cd26b78f32255778fb01fb8fc;p=python_utils.git Fixup argparse_utils' doctest and tweak test runner. --- diff --git a/argparse_utils.py b/argparse_utils.py index 2d2297c..530690c 100644 --- a/argparse_utils.py +++ b/argparse_utils.py @@ -242,7 +242,7 @@ def valid_duration(txt: str) -> datetime.timedelta: datetime.timedelta(seconds=180) >>> valid_duration('your mom') - datetime.timedelta(seconds=0) + datetime.timedelta(0) """ from datetime_utils import parse_duration diff --git a/tests/run_tests.sh b/tests/run_tests.sh index 6c418a2..486bd4e 100755 --- a/tests/run_tests.sh +++ b/tests/run_tests.sh @@ -82,6 +82,8 @@ if [ $(expr ${DOCTEST} + ${UNITTEST} + ${INTEGRATION}) -eq 0 ]; then exit 2 fi + +FAILED_TESTS="" if [ ${DOCTEST} -eq 1 ]; then for doctest in $(grep -lR doctest ${ROOT}/*.py); do BASE=$(basename ${doctest}) @@ -94,6 +96,7 @@ if [ ${DOCTEST} -eq 1 ]; then else echo -e "${FAILED}" FAILURES=$((FAILURES+1)) + FAILED_TESTS="${FAILED_TESTS}, ${BASE}" fi done fi @@ -106,6 +109,7 @@ if [ ${UNITTEST} -eq 1 ]; then ${test} if [ $? -ne 0 ]; then FAILURES=$((FAILURES+1)) + FAILED_TESTS="${FAILED_TESTS}, ${BASE}" fi done fi @@ -118,16 +122,20 @@ if [ ${INTEGRATION} -eq 1 ]; then ${test} if [ $? -ne 0 ]; then FAILURES=$((FAILURES+1)) + FAILED_TESTS="${FAILED_TESTS}, ${BASE}" fi done fi if [ ${FAILURES} -ne 0 ]; then + FAILED_TESTS=$(echo ${FAILED_TESTS} | sed 's/^, //g') if [ ${FAILURES} -eq 1 ]; then - echo -e "${RED}There was ${FAILURES} failure.${NC}" + echo -e "${RED}There was ${FAILURES} failure:" else - echo -e "${RED}There were ${FAILURES} failures.${NC}" + echo -e "${RED}There were ${FAILURES} failures:" fi + echo "${FAILED_TESTS}" + echo -e "${NC}" else - echo -e "${GREEN}Everything looks good.${NC}" + echo -e "${BLACK}${ON_GREEN}Everything looks good.${NC}" fi