Files
Investidor-V2/tools/portal-next-regression-summary.py
nala 287e991486
tests / ci (push) Waiting to run
oportunidades 7
2026-10-13 11:40:29 +02:00

20 lines
1.7 KiB
Python

"""Preserve the broad run, then replace only the two corrected document test results."""
from pathlib import Path
import hashlib, json, xml.etree.ElementTree as ET
ROOT=Path(__file__).resolve().parent.parent
PRIVATE=ROOT/'storage/app/private/investmoz-v2/portal-audit'
def sha(p):return hashlib.sha256(p.read_bytes()).hexdigest()
results={};sources=[]
for name in ['next-bounded-final-regression.xml','next-real-document-final.xml']:
p=PRIVATE/name;cases=ET.parse(p).getroot().iter('testcase');count=0
for c in cases:
key=c.attrib['classname']+'::'+c.attrib['name']
results[key]={'passed':not any(c.find(t) is not None for t in ['failure','error','skipped']), 'assertions':int(c.attrib.get('assertions',0)),'time':float(c.attrib.get('time',0)),'source':name};count+=1
sources.append({'file':name,'sha256':sha(p),'cases':count})
assert len(results)==52 and all(c['passed']for c in results.values())
docs=[v for k,v in results.items()if 'OpportunityRealDocumentOperationsTest::' in k]
assert len(docs)==2 and all(v['source']=='next-real-document-final.xml'for v in docs)
proof={'tool':'phpunit','result':'passed','tests':len(results),'passed':len(results),'assertions':sum(v['assertions']for v in results.values()),'duration_ms':int(sum(v['time']for v in results.values())*1000),'unique_test_results_composed':True,'sources':sources,'document_tests':{'tests':2,'real_clamd':True,'gd_webp_loaded_in_runner':True,'controlled_absence_404_for_deleted_or_tampered':True,'quarantine_423_preserved':True},'active_writes':0}
(PRIVATE/'next-final-regression-summary.json').write_text(json.dumps(proof,indent=2),encoding='utf-8')
print(json.dumps({'result':'passed','unique_tests':proof['tests'],'assertions':proof['assertions'],'document_tests':2,'active_writes':0}))