# -*- coding: utf-8 -*- """票 05:crm-opportunity 全模块回归(复用 t04-testopp.cmd 两步模式)。""" import io, sys, subprocess sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8') r = subprocess.run( ['cmd', '/c', r'e:\code\crm-backend-matt\.scratch\opportunity-bugfix\t04-testopp.cmd'], capture_output=True, cwd=r'e:\code\crm-backend-matt') out = r.stdout.decode('utf-8', errors='replace') + r.stderr.decode('utf-8', errors='replace') with open(r'e:\code\crm-backend-matt\.scratch\opportunity-bugfix\t05-testopp.log', 'w', encoding='utf-8') as f: f.write(out) print('EXIT=', r.returncode) # 只打印 surefire 汇总段 lines = out.splitlines() for i, ln in enumerate(lines): if 'Tests run' in ln or 'BUILD' in ln or 'STEP' in ln or 'EXIT' in ln: print(ln)