test: put scripts/ on sys.path so benchmark's sibling _cost import resolves in CI

CI collection failed with ModuleNotFoundError: No module named '_cost' because
exec_module loads the script without its dir on sys.path.

Co-Authored-By: Claudypoo <288921227+claudypoo@users.noreply.github.com>
This commit is contained in:
wassname
2026-06-19 08:47:41 +08:00
parent 28d04f1e1d
commit 2a50373311
+2
View File
@@ -4,6 +4,8 @@ from pathlib import Path
SCRIPT_PATH = Path(__file__).parents[1] / "scripts" / "metamath_gsm8k_benchmark.py"
# the script uses sibling imports (`from _cost import ...`), so scripts/ must be importable
sys.path.insert(0, str(SCRIPT_PATH.parent))
SPEC = importlib.util.spec_from_file_location("metamath_gsm8k_benchmark", SCRIPT_PATH)
benchmark = importlib.util.module_from_spec(SPEC)
assert SPEC.loader is not None