run_suite.py 931 Bytes
Newer Older
Lianmin Zheng's avatar
Lianmin Zheng committed
1
2
3
import argparse
import glob

4
from sglang.test.test_utils import run_unittest_files
Lianmin Zheng's avatar
Lianmin Zheng committed
5

6
suites = {
7
8
9
10
11
    "per-commit": [
        "test_srt_backend.py",
        # Skip this due to some OPENAI_API_KEY issues
        # "test_openai_backend.py",
    ],
12
13
}

Lianmin Zheng's avatar
Lianmin Zheng committed
14
15
16
17

if __name__ == "__main__":
    arg_parser = argparse.ArgumentParser()
    arg_parser.add_argument(
18
        "--timeout-per-file",
Lianmin Zheng's avatar
Lianmin Zheng committed
19
20
21
22
        type=int,
        default=1000,
        help="The time limit for running one file in seconds.",
    )
23
24
25
26
27
28
29
    arg_parser.add_argument(
        "--suite",
        type=str,
        default=list(suites.keys())[0],
        choices=list(suites.keys()) + ["all"],
        help="The suite to run",
    )
Lianmin Zheng's avatar
Lianmin Zheng committed
30
31
    args = arg_parser.parse_args()

32
33
34
35
    if args.suite == "all":
        files = glob.glob("**/test_*.py", recursive=True)
    else:
        files = suites[args.suite]
Lianmin Zheng's avatar
Lianmin Zheng committed
36

37
38
    exit_code = run_unittest_files(files, args.timeout_per_file)
    exit(exit_code)