|
|
@ -62,7 +62,7 @@ else: |
|
|
|
def shuffle_iteratable(it): |
|
|
|
def shuffle_iteratable(it): |
|
|
|
"""Return an iterable that randomly walks it""" |
|
|
|
"""Return an iterable that randomly walks it""" |
|
|
|
# take a random sampling from the passed in iterable |
|
|
|
# take a random sampling from the passed in iterable |
|
|
|
# we take an element with probablity 1/p and rapidly increase |
|
|
|
# we take an element with probability 1/p and rapidly increase |
|
|
|
# p as we take elements - this gives us a somewhat random set of values before |
|
|
|
# p as we take elements - this gives us a somewhat random set of values before |
|
|
|
# we've seen all the values, but starts producing values without having to |
|
|
|
# we've seen all the values, but starts producing values without having to |
|
|
|
# compute ALL of them at once, allowing tests to start a little earlier |
|
|
|
# compute ALL of them at once, allowing tests to start a little earlier |
|
|
@ -111,11 +111,15 @@ _TAG_COLOR = { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def message(tag, message, explanatory_text=None, do_newline=False): |
|
|
|
def message(tag, msg, explanatory_text=None, do_newline=False): |
|
|
|
|
|
|
|
if message.old_tag == tag and message.old_msg == msg and not explanatory_text: |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
message.old_tag = tag |
|
|
|
|
|
|
|
message.old_msg = msg |
|
|
|
if platform.system() == 'Windows': |
|
|
|
if platform.system() == 'Windows': |
|
|
|
if explanatory_text: |
|
|
|
if explanatory_text: |
|
|
|
print explanatory_text |
|
|
|
print explanatory_text |
|
|
|
print '%s: %s' % (tag, message) |
|
|
|
print '%s: %s' % (tag, msg) |
|
|
|
return |
|
|
|
return |
|
|
|
try: |
|
|
|
try: |
|
|
|
sys.stdout.write('%s%s%s\x1b[%d;%dm%s\x1b[0m: %s%s' % ( |
|
|
|
sys.stdout.write('%s%s%s\x1b[%d;%dm%s\x1b[0m: %s%s' % ( |
|
|
@ -125,12 +129,14 @@ def message(tag, message, explanatory_text=None, do_newline=False): |
|
|
|
_COLORS[_TAG_COLOR[tag]][1], |
|
|
|
_COLORS[_TAG_COLOR[tag]][1], |
|
|
|
_COLORS[_TAG_COLOR[tag]][0], |
|
|
|
_COLORS[_TAG_COLOR[tag]][0], |
|
|
|
tag, |
|
|
|
tag, |
|
|
|
message, |
|
|
|
msg, |
|
|
|
'\n' if do_newline or explanatory_text is not None else '')) |
|
|
|
'\n' if do_newline or explanatory_text is not None else '')) |
|
|
|
sys.stdout.flush() |
|
|
|
sys.stdout.flush() |
|
|
|
except: |
|
|
|
except: |
|
|
|
pass |
|
|
|
pass |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
message.old_tag = "" |
|
|
|
|
|
|
|
message.old_msg = "" |
|
|
|
|
|
|
|
|
|
|
|
def which(filename): |
|
|
|
def which(filename): |
|
|
|
if '/' in filename: |
|
|
|
if '/' in filename: |
|
|
|