Created
December 7, 2012 21:11
-
-
Save craigbeck/4236566 to your computer and use it in GitHub Desktop.
Python unittest colorized output
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/sh | |
RED=`echo '\x1b[31m'` | |
GREEN=`echo '\x1b[32m'` | |
CYAN=`echo '\x1b[34m'` | |
RESET=`echo '\x1b[0m'` | |
MAGENTA=`echo '\x1b[35m'` | |
python -m unittest discover $@ 2>&1 | sed "s/.*[oO][kK]$/$GREEN&$RESET/" \ | |
| sed "s/.*ERROR$/$MAGENTA&$RESET/" \ | |
| sed "s/.*FAIL$/$RED&$RESET/" \ | |
| sed "s/^FAILED.*/$RED&$RESET/" \ | |
| sed "s/.*skipped.*/$CYAN&$RESET/" \ | |
| sed "s/^ERROR:/$MAGENTA&/" \ | |
| sed "s/^FAIL.*/$RED&/" \ | |
| sed "s/^Ran.*tests in.*/$RESET&/" \ | |
| sed "s/^=*$/$RESET&/" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ship it.