Fixup argparse_utils' doctest and tweak test runner.
authorScott Gasch <[email protected]>
Thu, 23 Sep 2021 16:40:48 +0000 (09:40 -0700)
committerScott Gasch <[email protected]>
Thu, 23 Sep 2021 16:40:48 +0000 (09:40 -0700)
argparse_utils.py
tests/run_tests.sh

index 2d2297ccf2f8e7f9df99929925ab1b973ee5c44b..530690c0c70161bcd58d65389c724593f20003a2 100644 (file)
@@ -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
index 6c418a2424c52dcfa293f09de52fbb00e4570ed8..486bd4e220024cdc194b5441d82677cc4e869a08 100755 (executable)
@@ -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