"""Verify every .sx and .sx file in the repo parses without errors.""" import os import pytest from shared.sx.parser import parse_all def _collect_sx_files(): """Find all .sx and .sx 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((".sx", ".sx")): files.append(os.path.join(dirpath, fn)) return sorted(files) _SX_FILES = _collect_sx_files() @pytest.mark.parametrize("path", _SX_FILES, ids=[ os.path.relpath(p) for p in _SX_FILES ]) def test_parse(path): """Each sx 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"