Permalink
Browse files

Add colour

(Also lol it colours my diffs :D )
  • Loading branch information...
1 parent 76383a2 commit a63c6126e8e9dfe104db0e98c2cc025addeaadf4 @richo richo committed Sep 26, 2011
Showing with 26 additions and 5 deletions.
  1. +26 −5 test/unit/helpers.py
View
@@ -2,26 +2,47 @@
import os
import sys
+reset = ""
+def red(text):
+ red = ""
+ return "%s%s%s" % (red, text, reset)
+def green(text):
+ green = ""
+ return "%s%s%s" % (green, text, reset)
+def yellow(text):
+ yellow = ""
+ return "%s%s%s" % (yellow, text, reset)
+def blue(text):
+ blue = ""
+ return "%s%s%s" % (blue, text, reset)
+def purple(text):
+ purple = ""
+ return "%s%s%s" % (purple, text, reset)
+def cyan(text):
+ cyan = ""
+ return "%s%s%s" % (cyan, text, reset)
+
+
sys.path.append(os.getcwd())
def ASSERT(cond, errormsg):
if cond:
print errormsg
- print "\t\t\tPASS"
+ print green("\t\t\tPASS")
else:
# COLORS
print >>sys.stderr, errormsg
- print "\t\t\tFAIL"
+ print red("\t\t\tFAIL")
# TODO Add this to something and continue
# Maybe even raise a token exceptiont o catch so I can
# examine the stack
exit()
def START(test):
# epic kludge
os.current_test = test
- print("== %s ==" % test)
+ print(cyan("== %s ==" % test))
def END():
try:
- print("== %s ==" % os.current_test)
+ print(cyan("== %s ==" % os.current_test))
except AttributeError:
- ASSERT(False, "No test in progress")
+ ASSERT(False, red("No test in progress"))

0 comments on commit a63c612

Please sign in to comment.