README.md 721 Bytes
Newer Older
1
2
# Run Unit Tests

Lianmin Zheng's avatar
Lianmin Zheng committed
3
4
5
6
7
SGLang uses the built-in library [unittest](https://docs.python.org/3/library/unittest.html) as the testing framework.  

## Test Backend Runtime
```bash
cd sglang/test/srt
8
9

# Run a single file
Lianmin Zheng's avatar
Lianmin Zheng committed
10
python3 test_srt_endpoint.py
11

Lianmin Zheng's avatar
Lianmin Zheng committed
12
13
14
15
# Run a single test
python3 -m unittest test_srt_endpoint.TestSRTEndpoint.test_simple_decode

# Run a suite with multiple files
16
17
18
python3 run_suite.py --suite minimal
```

Lianmin Zheng's avatar
Lianmin Zheng committed
19
20
21
22
## Test Frontend Language
```bash
cd sglang/test/lang
export OPENAI_API_KEY=sk-*****
23
24

# Run a single file
Lianmin Zheng's avatar
Lianmin Zheng committed
25
26
27
28
python3 test_openai_backend.py

# Run a single test
python3 -m unittest test_openai_backend.TestOpenAIBackend.test_few_shot_qa
29

Lianmin Zheng's avatar
Lianmin Zheng committed
30
# Run a suite with multiple files
31
32
python3 run_suite.py --suite minimal
```