File size: 797 Bytes
fd5366a | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | # Copyright (c) 2026 CLSA contributors
# SPDX-License-Identifier: MIT
"""Figures: each script must run when its result exists, and skip cleanly otherwise."""
from __future__ import annotations
import subprocess
import sys
from pathlib import Path
import pytest
ROOT = Path(__file__).resolve().parents[1]
FIGURES = ROOT / "figures"
@pytest.mark.parametrize("script", sorted(p.name for p in FIGURES.glob("f*.py")))
def test_figure_script(script):
out = subprocess.run(
[sys.executable, script], cwd=str(FIGURES), capture_output=True, text=True
)
combined = (out.stdout + out.stderr).lower()
if "no such file" in combined or "missing" in combined or "skipped" in combined:
pytest.skip(f"{script}: no result yet")
assert out.returncode == 0, out.stderr[-800:]
|