Last active
July 28, 2016 09:07
-
-
Save rj76/718795f94024dd3c922d79a8c0fc89c1 to your computer and use it in GitHub Desktop.
Run Django tests and let espeak playout the result
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/bin/bash | |
convertsecs() { | |
((h=${1}/3600)) | |
((m=(${1}%3600)/60)) | |
((s=${1}%60)) | |
printf "Tests took %02d hours, %02d minutes, %02d seconds...\n" $h $m $s | |
} | |
env python manage.py test --settings settings.test_settings $1 2> logs/test_stderr.log | |
if [ $? -ne 0 ]; then | |
cat logs/test_stderr.log | |
fi | |
seconds=`grep Ran logs/test_stderr.log | sed -e 's/^Ran\s[[:digit:]]\+\stests\sin\s//' | sed -e 's/\.[[:digit:]]\+s$//'` | |
echo $(convertsecs $seconds) > result.txt | |
tail -n1 logs/test_stderr.log | \ | |
sed -e 's/failures=\([[:digit:]]\+\)/\1 failures/' | \ | |
sed -e 's/skipped=\([[:digit:]]\+\)/\1 skipped/' | \ | |
sed -e 's/errors=\([[:digit:]]\+\)/\1 errors/' | \ | |
sed -e 's/^OK/All tests successful /' >> result.txt && \ | |
espeak -ven+f2 -s 180 -w result.wav -f result.txt && \ | |
vlc --play-and-exit --quiet --intf dummy vcd:// result.wav && \ | |
rm result.txt result.wav |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
nice :)