"""Run the independently enumerated finite tests and write a machine-readable summary.""" from pathlib import Path import json import platform import sys import time import unittest root=Path(__file__).resolve().parent sys.path.insert(0,str(root/'tests')) start=time.perf_counter() suite=unittest.defaultTestLoader.discover(str(root/'tests'),pattern='test_*.py') result=unittest.TextTestRunner(verbosity=2).run(suite) summary={'tests_run':result.testsRun,'failures':len(result.failures),'errors':len(result.errors), 'passed':result.wasSuccessful(),'python':platform.python_version(), 'elapsed_seconds_observed':time.perf_counter()-start, 'finite_tests_are_not_a_formal_proof':True} (root/'evidence'/'test_summary.json').write_text(json.dumps(summary,indent=2)+'\n',encoding='utf-8') raise SystemExit(0 if result.wasSuccessful() else 1)