Skip to content

Commit 1e023ee

Browse files
committed
[CI] Skip CI for non-runtime directories and add unittest Claude skill
1 parent dad5a43 commit 1e023ee

4 files changed

Lines changed: 553 additions & 0 deletions

File tree

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# write-fastdeploy-unittest
2+
3+
A skill that guides AI agents to write CI-compliant unit tests for the FastDeploy project.
4+
5+
## Features
6+
7+
- Automatically selects the appropriate test pattern based on the code under test (pure logic / GPU kernel / offline inference / E2E serving)
8+
- Follows FastDeploy CI classification rules (multi-GPU sequential vs single-GPU parallel)
9+
- Meets the 80% diff coverage PR threshold
10+
- Correctly uses port variables, log isolation, and resource cleanup per CI conventions
11+
12+
## Usage
13+
14+
### Basic — specify a source file
15+
16+
```
17+
Use the write-fastdeploy-unittest skill to add unit tests for fastdeploy/cache_manager/transfer_factory/file_store/file_store.py
18+
```
19+
20+
### From coverage report — paste the line directly
21+
22+
```
23+
Use the write-fastdeploy-unittest skill to add unit tests for:
24+
25+
fastdeploy/model_executor/model_loader/default_loader.py 48 32 14 0 26% 37-38, 42, 46-52, 56-66, 69-97
26+
```
27+
28+
The coverage report format is: `file_path Stmts Miss Branch BrMiss Cover% Missing_lines`. The agent will focus on the uncovered lines and write tests specifically targeting those branches.
29+
30+
The agent will automatically:
31+
1. Read the target source file and analyze uncovered lines
32+
2. Select the appropriate test pattern (Pattern 1-4)
33+
3. Generate a test file in the corresponding `tests/` subdirectory
34+
4. Run tests and verify coverage
35+
36+
## Test Pattern Quick Reference
37+
38+
| Pattern | Use Case | Dependencies |
39+
|---------|----------|--------------|
40+
| 1 — Pure Logic | config, utils, scheduler, router, etc. | No GPU; mock external deps |
41+
| 2 — GPU Kernel | ops, layers, numerical computation | Requires GPU; `@pytest.mark.gpu` |
42+
| 3 — Offline Inference | LLM API, model loading | Requires MODEL_PATH |
43+
| 4 — E2E Serving | End-to-end HTTP serving | subprocess + ports |
44+
45+
## Key Conventions
46+
47+
- Test file naming: `test_<module>.py`
48+
- Test class naming: `Test<Module>`
49+
- Coverage verification: `python -m coverage run --source=<directory> -m pytest <test_file> && coverage report -m`
50+
- The `--source` parameter must be a directory path, not a dotted module name
51+
52+
## Related Files
53+
54+
- [SKILL.md](SKILL.md) — Full skill instruction document

0 commit comments

Comments
 (0)