3 source /home/scott/bin/color_vars.sh
5 ROOT=/home/scott/lib/python_modules
13 echo "Usage: dup <string> <count>"
16 local times=$(seq 1 $2)
24 echo "Usage: make_header <required title> <color>"
28 local title_len=${#title}
29 title_len=$((title_len + 4))
32 local right=$(($width-($title_len+$left)))
35 echo -ne "[ ${color}${title}${NC} ]"
41 while [[ $# -gt 0 ]]; do
59 echo "Usage: $0 [-a]|[-i][-u][-d]"
61 echo "Runs tests under ${ROOT}. Options control which test types:"
63 echo " -a | --all . . . . . . . . . . . . Run all types of tests"
64 echo " -d | --doctests . . . . . . . . . Run doctests"
65 echo " -u | --unittests . . . . . . . . . Run unittests"
66 echo " -i | --integration . . . . . . . . Run integration tests"
68 echo "Argument $key was not recognized."
75 if [ ${DOCTEST} -eq 1 ]; then
76 for doctest in $(grep -lR doctest ${ROOT}/*.py); do
77 BASE=$(basename ${doctest})
78 BASE="${BASE} (doctest)"
79 make_header "${BASE}" "${CYAN}"
80 OUT=$( python3 ${doctest} 2>&1 )
81 if [ "$OUT" == "" ]; then
85 FAILURES=$((FAILURES+1))
90 if [ ${UNITTEST} -eq 1 ]; then
91 for test in $(find ${ROOT} -name "*_test.py" -print); do
92 BASE=$(basename ${test})
93 BASE="${BASE} (unittest)"
94 make_header "${BASE}" "${GREEN}"
97 FAILURES=$((FAILURES+1))
102 if [ ${INTEGRATION} -eq 1 ]; then
103 for test in $(find ${ROOT} -name "*_itest.py" -print); do
104 BASE=$(basename ${test})
105 BASE="${BASE} (integration test)"
106 make_header "${BASE}" "${ORANGE}"
108 if [ $? -ne 0 ]; then
109 FAILURES=$((FAILURES+1))
114 if [ ${FAILURES} -ne 0 ]; then
115 echo -e "${RED}There were ${FAILURES} failure(s).${NC}"