@@ -161,8 +161,8 @@ def get_blank_repo_metrics(
161
161
return blank_repo_metrics
162
162
163
163
leaderboard_header = """\n \n ## Leaderboard ({split})
164
- | Name | Repos Resolved (/{num_repos}) | Test Duration (s) | Date | Analysis | Github |
165
- |------|:-------------------------:|:--------------------:|:----------:|----|----| """
164
+ | Name | Repos Resolved (/{num_repos}) | Total Tests Passed (/{total_num_tests}) Test Duration (s) | Date | Analysis | Github |
165
+ |------|:-------------------------:|:--------------------:|:--------------------:|:---------- :|----|----| """
166
166
167
167
submission_table_header = """# Submission Name: **{display_name}** (split: {split})
168
168
@@ -177,19 +177,25 @@ def get_blank_repo_metrics(
177
177
def render_mds (overwrite_previous , subfolder = "docs" ):
178
178
leaderboard = {}
179
179
180
+ split_to_total_tests = {"lite" : 3628 , "all" : 140926 } # hard-coded to skip running it later
180
181
for split in tqdm .tqdm (["lite" , "all" ]):
181
182
num_repos = len (SPLIT [split ])
183
+ # total_num_tests = 0
184
+ # for repo_name in SPLIT[split]:
185
+ # repo_tests = subprocess.run(['commit0', 'get-tests', repo_name], capture_output=True, text=True).stdout.strip()
186
+ # total_num_tests += len(repo_tests.splitlines())
182
187
leaderboard [
183
188
split
184
- ] = leaderboard_header .format (split = split , num_repos = num_repos )
189
+ ] = leaderboard_header .format (split = split , num_repos = num_repos , total_num_tests = split_to_total_tests [ split ] )
185
190
186
191
for org_path in tqdm .tqdm (glob .glob (os .path .join (analysis_files_path , "*" ))):
187
192
org_name = os .path .basename (org_path )
188
193
if org_name in {"blank" , "repos" , "submission_repos" }:
189
194
continue
190
- repos_resolved = 0
191
- total_duration = 0.0
192
195
for branch_path in glob .glob (os .path .join (org_path , "*.json" )):
196
+ cum_tests_passed = 0
197
+ repos_resolved = 0
198
+ total_duration = 0.0
193
199
branch_metrics = json .load (open (branch_path ))
194
200
submission_info = branch_metrics ["submission_info" ]
195
201
split = submission_info ["split" ]
@@ -262,6 +268,7 @@ def render_mds(overwrite_previous, subfolder="docs"):
262
268
f"### { shortened_testname } \n \n <details><summary> <pre>{ shortened_testname } "
263
269
f"</pre></summary><pre>\n { failure ['failure_string' ]} \n </pre>\n </details>\n "
264
270
)
271
+ cum_tests_passed += pytest_info ["summary" ]["passed" ]
265
272
total_duration += pytest_info ["duration" ]
266
273
repos_resolved += int (resolved )
267
274
if write_submission :
@@ -293,6 +300,7 @@ def render_mds(overwrite_previous, subfolder="docs"):
293
300
leaderboard [split ] += (
294
301
f"\n |{ display_name } |"
295
302
f"{ repos_resolved } |"
303
+ f"{ cum_tests_passed } |"
296
304
f"{ total_duration :.2f} |"
297
305
f"{ submission_date } |"
298
306
f"{ analysis_link } |"
@@ -378,13 +386,17 @@ def main(args):
378
386
json .dump (repo_metrics , open (repo_metrics_output_file , "w" ), indent = 4 )
379
387
380
388
if args .get_reference_details :
389
+ branch_name = "reference"
390
+ org_name = f"commit0_{ args .split } "
391
+ commit0_dot_file_path = os .path .join (
392
+ analysis_files_path , "repos" , org_name , branch_name , ".commit0.yaml"
393
+ )
394
+ submission_repos_path = os .path .join (analysis_files_path , "repos" , org_name , branch_name )
381
395
if args .do_setup :
382
396
os .system (
383
- f"commit0 setup { args .split } --base-dir { analysis_files_path } /repos "
384
- f"--commit0-dot-file-path { analysis_files_path } /repos/.commit0.yaml "
397
+ f"commit0 setup { args .split } --base-dir { submission_repos_path } "
398
+ f"--commit0-dot-file-path { commit0_dot_file_path } "
385
399
)
386
- branch_name = "reference"
387
- org_name = "commit0"
388
400
submission_metrics_output_file = os .path .join (
389
401
analysis_files_path , org_name , f"{ branch_name } .json"
390
402
)
@@ -408,7 +420,7 @@ def main(args):
408
420
if args .overwrite_previous_eval or need_re_eval :
409
421
os .system (
410
422
"commit0 evaluate --reference "
411
- f"--commit0-dot-file-path { analysis_files_path } /repos/.commit0.yaml "
423
+ f"--commit0-dot-file-path { commit0_dot_file_path } "
412
424
)
413
425
# get coverage and pytest info for each repo
414
426
for example in dataset :
0 commit comments