Merge pull request #1569 from nicolasnoble/run_tests_stop_the_spam

Prevents run_tests from spamming.
pull/1572/head
Craig Tiller 10 years ago
commit a181567b1e
  1. 14
      tools/run_tests/jobset.py

@ -62,7 +62,7 @@ else:
def shuffle_iteratable(it):
"""Return an iterable that randomly walks it"""
# 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
# 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
@ -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 explanatory_text:
print explanatory_text
print '%s: %s' % (tag, message)
print '%s: %s' % (tag, msg)
return
try:
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]][0],
tag,
message,
msg,
'\n' if do_newline or explanatory_text is not None else ''))
sys.stdout.flush()
except:
pass
message.old_tag = ""
message.old_msg = ""
def which(filename):
if '/' in filename:

Loading…
Cancel
Save