26 lines
1.3 KiB
Python
26 lines
1.3 KiB
Python
"""Capture pure protocol/aggregation unit tests; no brain simulation."""
|
|
import json
|
|
from pathlib import Path
|
|
import subprocess
|
|
import sys
|
|
|
|
ROOT=Path('/data/digital-drosophila')
|
|
MODEL=ROOT/'models/male-cns-lif/author-apl-lab-v2'
|
|
EXP=ROOT/'experiments/phase4ag-author-apl-r2'
|
|
sys.path.insert(0,str(MODEL))
|
|
from context import check,save,digest
|
|
|
|
check();results=[]
|
|
for name,python in (
|
|
('science',ROOT/'models/male-cns-lif/.venv/bin/python'),
|
|
('pinned-brian',ROOT/'experiments/phase4ad-author-semantics/environment/.venv/bin/python')):
|
|
log=EXP/'regression'/('unit-tests-'+name+'.log')
|
|
with log.open('x',encoding='utf-8') as out:
|
|
result=subprocess.run([str(python),'-B','-m','unittest','discover','-s',str(MODEL),'-p','test_*.py','-v'],
|
|
cwd=MODEL,stdout=out,stderr=subprocess.STDOUT,timeout=120,check=False)
|
|
results.append(dict(environment=name,pass_all=result.returncode==0,log=str(log.relative_to(EXP)),sha256=digest(log)))
|
|
save(EXP/'regression/unit-tests.json',dict(pass_all=all(r['pass_all'] for r in results),results=results,
|
|
scope='Pure protocol and synthetic aggregation only, no scientific trajectory',runner_sha256=digest(__file__)))
|
|
assert all(r['pass_all'] for r in results)
|
|
print(json.dumps(results),flush=True)
|