| 1 | # SPDX-License-Identifier: Apache-2.0 |
| 2 | # SPDX-FileCopyrightText: Copyright contributors to the vLLM project |
| 3 | |
| 4 | from pathlib import Path |
| 5 | |
| 6 | |
| 7 | def pytest_addoption(parser): |
| 8 | parser.addoption( |
| 9 | "--config-list-file", |
| 10 | required=True, |
| 11 | help="File containing Qwen4Exp evaluation config files", |
| 12 | ) |
| 13 | |
| 14 | |
| 15 | def pytest_generate_tests(metafunc): |
| 16 | if "config_filename" not in metafunc.fixturenames: |
| 17 | return |
| 18 | |
| 19 | config_list_path = Path(metafunc.config.getoption("--config-list-file")) |
| 20 | if not config_list_path.is_absolute(): |
| 21 | test_relative_path = Path(__file__).parent / config_list_path |
| 22 | config_list_path = ( |
| 23 | test_relative_path |
| 24 | if test_relative_path.exists() |
| 25 | else Path.cwd() / config_list_path |
| 26 | ) |
| 27 | |
| 28 | config_dir = config_list_path.parent |
| 29 | config_files = [ |
| 30 | config_dir / line.strip() |
| 31 | for line in config_list_path.read_text(encoding="utf-8").splitlines() |
| 32 | if line.strip() and not line.lstrip().startswith("#") |
| 33 | ] |
| 34 | missing = [path for path in config_files if not path.exists()] |
| 35 | if missing: |
| 36 | raise FileNotFoundError(f"Missing evaluation configs: {missing}") |
| 37 | |
| 38 | metafunc.parametrize( |
| 39 | "config_filename", |
| 40 | config_files, |
| 41 | ids=[config_file.stem for config_file in config_files], |
| 42 | ) |