#!/usr/bin/env python3 """Run the 33 main-article tests and reconstruct the saved path summaries.""" from pathlib import Path import argparse import os import subprocess import sys ROOT = Path(__file__).resolve().parent def main() -> None: argparse.ArgumentParser(description=__doc__).parse_args() env = os.environ.copy() env['PYTHONDONTWRITEBYTECODE'] = '1' commands = [ [sys.executable, '-m', 'pytest', 'tests', '-q', '-p', 'no:cacheprovider'], [sys.executable, 'code/validate_results.py'], ] for command in commands: result = subprocess.run(command, cwd=ROOT, env=env, text=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) print(result.stdout, end='', flush=True) if result.returncode: raise RuntimeError('Verification failed: ' + ' '.join(command)) if __name__ == '__main__': try: main() except (OSError, RuntimeError) as exc: print(exc, file=sys.stderr) sys.exit(1)