def validate(stdout,stderr,result,causes): expected = { 'map': {1: 0.1, 2: 0.2, 3: 0.3}, 'map': {1: 10, 2: 20, 3: 30}, 'map': {-1: 'minus one', 0: 'zero', 2: 'two'}, 'map': {'aa': 0.1, 'bb': 0.2, 'cc': 3}, 'map': {'a': 1, 'b': 2, 'c': 3}, 'map': {'a': 'sddsgsgsdgdggf', 'b': 'sddsgsgsdgdggf', 'c': 'sddsgsgsdgdggf'}, 'map >': {'aaa': [1, 2, 3], 'bbb': [1, 2, 3], 'ccc': [0.1, 0.2, 0.3]}, 'map >': {'aaa': [1, 2, 3], 'bbb': [4, 5, 6], 'ccc': [7, 8, 9]}, 'map >': {'aaa': ['a', 'b', 'c'], 'bbb': ['a', 'b', 'c'], 'ccc': ['a', 'b', 'c']}, 'map': {0: 'UZero', 1: 'UOne', 2: 'UTwo'}, 'pair': (3141.592, 2.1828183), 'pair': (3, 2), 'vector >': [(0, 1), (1, 2), (2, 3), (3, 4), (4, 5), (5, 6), (6, 7), (7, 8)], 'vector >': [(1, 1), (2, 1), (3, 2), (4, 3), (5, 5)], 'vector >': [[0, 1, 2], [0, -0.5, -0.25]], 'vector >': [['a', 'b', 'c'], ['A', 'B', 'C']] } # Hack for win32: 'string' become 'basic_string...', so I have to # modify the keys of the dictionary import os if os.environ['CMTCONFIG'][0:3] == 'win': for k in expected.keys(): if 'string' in k: expected[k.replace('string','basic_string >').replace('>>','> >')] = expected[k] del expected[k] import re signature = re.compile(r'xProps\s*SUCCESS\s*My Properties :') prop_sign = re.compile(r'''xProps\s*SUCCESS\s*'([^']*)':(.*)''') output = map(lambda l: l.rstrip(), stdout.splitlines()) i = output.__iter__() try: while not signature.match(i.next()): pass properties = {} for l in i: m = prop_sign.match(l) if m: properties[m.group(1)] = eval(m.group(2)) else: break if properties != expected: causes.append('properties') from pprint import PrettyPrinter pp = PrettyPrinter() result['GaudiTest.properties.expected'] = result.Quote(pp.pformat(expected)) result['GaudiTest.properties.found'] = result.Quote(pp.pformat(properties)) except StopIteration: causes.append('missing signature')