Make hb-diff-filter-failtures retain all test info for failed tests

This commit is contained in:
Behdad Esfahbod 2012-05-09 07:30:07 +02:00
parent f1eb008cc7
commit 1058d031e2
1 changed files with 28 additions and 9 deletions

View File

@ -149,16 +149,35 @@ class ZipDiffer:
class DiffFilters: class DiffFilters:
@staticmethod @staticmethod
def filter_failures (f, symbols=diff_symbols): def filter_failures (f):
for lines in DiffHelpers.separate_test_cases (f):
if any (l[0] != ' ' for l in lines):
for l in lines: yield l
class DiffHelpers:
@staticmethod
def separate_test_cases (f):
'''Reads lines from f, and if the lines have identifiers, ie.
have a colon character, groups them by identifier,
yielding lists of all lines with the same identifier.'''
acc = []
iden = None
for l in f: for l in f:
if l[0] in symbols: if ':' not in l:
# TODO retain all lines of the failure if acc: yield acc
yield l acc = []
iden = None
yield [l]
class ShapeFilters: continue
l_iden = l[1:l.index (':')]
pass if acc and iden != l_iden:
yield acc
acc = []
iden = l_iden
acc.append (l)
if acc: yield acc
class FilterHelpers: class FilterHelpers: