Files
CelerisLab/tests/validation/experimental_full9/test_runner.py
T

42 lines
2.0 KiB
Python

"""Experimental provenance and removal-only config checks, CPU only."""
from copy import deepcopy
from pathlib import Path
import sys
import unittest
sys.path.insert(0,str(Path(__file__).resolve().parent))
import run_bodyless as r
def test_config_only_boundary_changes():
cfg,body,p,manifest=r.configuration(r.ROOT)
import run_refined_dfg as runner
h,_=runner.helpers(r.ROOT);baseline,baseline_body,baseline_p=runner.config(h,80)
expected=deepcopy(baseline);expected['method']['inlet']['scheme']=r.VARIANT
assert cfg==expected and p==baseline_p
expected_body=deepcopy(baseline_body);expected_body['objects']=[]
assert body==expected_body
assert manifest['commit']=='926ca27407c26ca11283282a6e53249925725376'
assert cfg['method']['collision']=='SRT' and cfg['method']['outlet']['srt_neq_damp']==.5
def test_historical_manifest_rejects_candidate():
with unittest.TestCase().assertRaisesRegex(ValueError,'Pinned source mismatch'):
r.diagnostic.source_config(r.ROOT)
def test_different_runtime_checkout_rejected():
with unittest.TestCase().assertRaisesRegex(ValueError,'executing harness checkout'):
r.configuration(r.ROOT.parent)
def test_experimental_preflight():
import subprocess,json
from tempfile import TemporaryDirectory
with TemporaryDirectory() as temp:
subprocess.run([sys.executable,str(Path(r.__file__)),'--output',temp,'--record-inlet-history'],check=True,capture_output=True)
result=json.loads((Path(temp)/'preflight.json').read_text())
assert result['experimental_variant']==r.VARIANT
assert result['history_requested_steps']==[0,196] and result['max_steps']==320
assert not result['executed']
assert result['numerical_source_commit']=='926ca27407c26ca11283282a6e53249925725376'
if __name__=='__main__':
result=unittest.TextTestRunner(verbosity=2).run(unittest.TestSuite(unittest.FunctionTestCase(fn) for name,fn in sorted(globals().items()) if name.startswith('test_')))
raise SystemExit(not result.wasSuccessful())