"""Verify every .sexpr and .sexp file in the repo parses without errors.""" import os import pytest from shared.sexp.parser import parse_all def _collect_sexp_files(): """Find all .sexpr and .sexp files under the repo root.""" repo = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname( os.path.abspath(__file__) )))) files = [] for dirpath, _dirs, filenames in os.walk(repo): if "node_modules" in dirpath or ".git" in dirpath or "artdag" in dirpath: continue for fn in filenames: if fn.endswith((".sexpr", ".sexp")): files.append(os.path.join(dirpath, fn)) return sorted(files) _SEXP_FILES = _collect_sexp_files() @pytest.mark.parametrize("path", _SEXP_FILES, ids=[ os.path.relpath(p) for p in _SEXP_FILES ]) def test_parse(path): """Each sexp file should parse without errors.""" with open(path) as f: source = f.read() exprs = parse_all(source) assert len(exprs) > 0, f"{path} produced no expressions"