Add ANSI support to the build log view

This commit is contained in:
Joseph Schorr 2014-02-13 22:01:26 -05:00
parent 8794547593
commit 540da00c64
7 changed files with 364 additions and 6 deletions

View file

@ -129,7 +129,12 @@ class TestBuildLogs(BuildLogs):
@staticmethod
def _generate_logs(count):
return [(1, {'message': get_sentence()}, None) for _ in range(count)]
others = []
if random.randint(0, 10) <= 8:
count = count - 2
others = [(1, {'message': '\x1b[91m' + get_sentence()}, None), (1, {'message': '\x1b[0m'}, None)]
return others + [(1, {'message': get_sentence()}, None) for _ in range(count)]
@staticmethod
def _compute_total_completion(statuses, total_images):