13
13
PythonTaskData ,
14
14
RankCriterion ,
15
15
build_task_config ,
16
- make_task_definition ,
16
+ make_task_definition , MilestoneData ,
17
17
)
18
18
19
19
@@ -57,7 +57,6 @@ def test_from_dict_python_task():
57
57
58
58
59
59
def test_from_dict_cuda_task ():
60
- """Test creating LeaderboardTask from dict with CUDA config"""
61
60
"""Test creating LeaderboardTask from dict with CUDA config"""
62
61
data = {
63
62
"lang" : "cu" ,
@@ -93,7 +92,7 @@ def test_type_mismatch():
93
92
)
94
93
95
94
96
- def test_to_dict (leaderboard_task ):
95
+ def test_to_dict (leaderboard_task : LeaderboardTask ):
97
96
"""Test converting LeaderboardTask to dict"""
98
97
result = leaderboard_task .to_dict ()
99
98
@@ -114,15 +113,15 @@ def test_to_dict(leaderboard_task):
114
113
]
115
114
116
115
117
- def test_serialization_roundtrip (leaderboard_task ):
116
+ def test_serialization_roundtrip (leaderboard_task : LeaderboardTask ):
118
117
"""Test to_str and from_str work together"""
119
118
json_str = leaderboard_task .to_str ()
120
119
reconstructed = LeaderboardTask .from_str (json_str )
121
120
122
121
assert reconstructed == leaderboard_task
123
122
124
123
125
- def test_build_task_config_python (leaderboard_task ):
124
+ def test_build_task_config_python (leaderboard_task : LeaderboardTask ):
126
125
"""Test build_task_config with Python task and submission content."""
127
126
submission_content = "print('Hello World')"
128
127
arch = "sm_80"
@@ -180,6 +179,11 @@ def test_build_task_config_python(leaderboard_task):
180
179
templates:
181
180
Python: "template.py"
182
181
CUDA: "template.cu"
182
+ milestones:
183
+ - name: "Milestone"
184
+ source: "milestone.py"
185
+ description: "This milestone is a test milestone"
186
+ exclude_gpus: ["A100"]
183
187
"""
184
188
185
189
@@ -190,13 +194,14 @@ def task_directory(tmp_path):
190
194
Path .write_text (tmp_path / "kernel.py" , "def kernel(): pass" )
191
195
Path .write_text (tmp_path / "template.py" , "# Python template" )
192
196
Path .write_text (tmp_path / "template.cu" , "// CUDA template" )
197
+ Path .write_text (tmp_path / "milestone.py" , "def milestone(): pass" )
193
198
194
199
# Create task.yml
195
200
Path .write_text (tmp_path / "task.yml" , TASK_YAML )
196
201
return tmp_path
197
202
198
203
199
- def test_make_task_definition (task_directory ):
204
+ def test_make_task_definition (task_directory : Path ):
200
205
"""Test make_task_definition with a complete YAML structure"""
201
206
202
207
# Test the function
@@ -206,6 +211,7 @@ def test_make_task_definition(task_directory):
206
211
assert isinstance (result , LeaderboardDefinition )
207
212
assert result .description == "Test task description"
208
213
assert result .templates == {"Python" : "# Python template" , "CUDA" : "// CUDA template" }
214
+ assert result .milestones == [MilestoneData (name = "Milestone" , code = "def milestone(): pass" , description = "This milestone is a test milestone" , exclude_gpus = ["A100" ])]
209
215
210
216
# Verify the task
211
217
task = result .task
0 commit comments