mirror of
https://github.com/wassname/lora-lite.git
synced 2026-06-27 16:45:56 +08:00
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:
@@ -4,6 +4,8 @@ from pathlib import Path
|
|||||||
|
|
||||||
|
|
||||||
SCRIPT_PATH = Path(__file__).parents[1] / "scripts" / "metamath_gsm8k_benchmark.py"
|
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)
|
SPEC = importlib.util.spec_from_file_location("metamath_gsm8k_benchmark", SCRIPT_PATH)
|
||||||
benchmark = importlib.util.module_from_spec(SPEC)
|
benchmark = importlib.util.module_from_spec(SPEC)
|
||||||
assert SPEC.loader is not None
|
assert SPEC.loader is not None
|
||||||
|
|||||||
Reference in New Issue
Block a user