Created
April 7, 2017 21:08
-
-
Save teepark/889bc351c0e953b738377da45e70919a to your computer and use it in GitHub Desktop.
colorful nosetests wrapper
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
#!/usr/bin/env bash | |
set -euo pipefail | |
simple() { | |
sed -E \ | |
-e "1 s/\./$(printf '\033[32m.\033[0m')/g" \ | |
-e "1 s/S/$(printf '\033[33mS\033[0m')/g" \ | |
-e "1 s/F/$(printf '\033[31mF\033[0m')/g" \ | |
-e "s/^(FAILED.*)$/$(printf '\033[31m\\1\033[0m')/" \ | |
-e "s/^(OK.*)$/$(printf '\033[32m\\1\033[0m')/" | |
} | |
verbose() { | |
sed -E \ | |
-e "s/^(.*\.\.\. ok)$/$(printf '\033[32m\\1\033[0m')/" \ | |
-e "s/^(.*\.\.\. SKIP: .*)$/$(printf '\033[33m\\1\033[0m')/" \ | |
-e "s/^(.*\.\.\. FAIL)$/$(printf '\033[31m\\1\033[0m')/" \ | |
-e "s/^(FAILED.*)$/$(printf '\033[31m\\1\033[0m')/" \ | |
-e "s/^(OK.*)$/$(printf '\033[32m\\1\033[0m')/" | |
} | |
VERBOSE= | |
for arg in $@; do | |
if [[ "$arg" = "-v" ]]; then | |
VERBOSE=1 | |
fi | |
done | |
if [[ "$VERBOSE" ]]; then | |
nosetests "$@" 2>&1| verbose | |
else | |
nosetests "$@" 2>&1| simple | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment