reportist/tests/support_render.py

14 lines
553 B
Python

"""Python-only test adapter for the production shell renderer."""
from pathlib import Path
import subprocess
ROOT = Path(__file__).resolve().parents[1]
def render(input_path, output_path, typst="typst", force=False):
command = ["bash", str(ROOT / "tools/render.sh"), str(input_path), "--output", str(output_path), "--typst", str(typst)]
if force:
command.append("--force")
result = subprocess.run(command, text=True, capture_output=True)
if result.returncode:
raise ValueError((result.stderr or result.stdout).strip())