@@ -53,13 +53,22 @@ def run_agent_for_repo(
5353 """Run Aider for a given repository."""
5454 # get repo info
5555 _ , repo_name = example ["repo" ].split ("/" )
56+ print ("Working on repo: " , repo_name )
5657
57- repo_name = repo_name .lower ()
58- repo_name = repo_name .replace ("." , "-" )
58+ # repo_name = repo_name.lower()
59+ # repo_name = repo_name.replace(".", "-")
5960
6061 repo_path = os .path .join (repo_base_dir , repo_name )
6162 repo_path = os .path .abspath (repo_path )
6263
64+ # get target files to edit and test files to run
65+ target_edit_files = get_target_edit_files (
66+ repo_path , example ["src_dir" ], example ["test" ]["test_dir" ]
67+ )
68+ # Call the commit0 get-tests command to retrieve test files
69+ test_files_str = get_tests (repo_name , verbose = 0 )
70+ test_files = sorted (list (set ([i .split (":" )[0 ] for i in test_files_str ])))
71+
6372 try :
6473 local_repo = Repo (repo_path )
6574 except Exception :
@@ -102,22 +111,15 @@ def run_agent_for_repo(
102111
103112 # TODO: make this path more general
104113 commit0_dot_file_path = str (Path (repo_path ).parent .parent / ".commit0.yaml" )
114+
105115 with DirContext (repo_path ):
106116 if agent_config is None :
107117 raise ValueError ("Invalid input" )
108118
109- target_edit_files = get_target_edit_files (
110- repo_path , example ["src_dir" ], example ["test" ]["test_dir" ]
111- )
112-
113119 if agent_config .run_tests :
114- # Call the commit0 get-tests command to retrieve test files
115- test_files_str = get_tests (repo_name , verbose = 0 )
116- test_files = sorted (list (set ([i .split (":" )[0 ] for i in test_files_str ])))
117-
118120 # when unit test feedback is available, iterate over test files
119121 for test_file in test_files :
120- test_cmd = f"python -m commit0 test { repo_path } { test_file } --branch { branch } --backend { backend } --commit0_dot_file_path { commit0_dot_file_path } "
122+ test_cmd = f"python -m commit0 test { repo_path } { test_file } --branch { branch } --backend { backend } --commit0-dot-file-path { commit0_dot_file_path } "
121123 test_file_name = test_file .replace (".py" , "" ).replace ("/" , "__" )
122124 test_log_dir = experiment_log_dir / test_file_name
123125 lint_cmd = get_lint_cmd (repo_name , agent_config .use_lint_info )
@@ -128,6 +130,7 @@ def run_agent_for_repo(
128130 lint_cmd ,
129131 target_edit_files ,
130132 test_log_dir ,
133+ test_first = True ,
131134 )
132135 # cost = agent_return.last_cost
133136 else :
0 commit comments