# -*- coding: utf-8 -*- """票 09:t06-test2.log 汇总(教训:判 BUILD 看 log 行,不看 EXIT)。""" import io, re, sys sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8') t = open(r'e:\code\crm-backend-matt\.scratch\opportunity-bugfix\t06-test2.log', encoding='utf-8', errors='replace').read() m = re.findall(r'Tests run: (\d+), Failures: (\d+), Errors: (\d+)', t) print('suites', len(m), 'total', sum(int(a) for a, b, c in m), 'F', sum(int(b) for a, b, c in m), 'E', sum(int(c) for a, b, c in m)) print('BUILD SUCCESS' if 'BUILD SUCCESS' in t else ('BUILD FAILURE' if 'BUILD FAILURE' in t else 'NO-BUILD-LINE')) for line in t.splitlines(): if 'OpportunityDetailServiceImplTest' in line and 'Tests run' in line: print(line.strip())