MCPcopy Create free account
hub / github.com/catid/supercharger / test_pair

Method test_pair

codegen/codegen.py:169–193  ·  view source on GitHub ↗
(self, code_id, test_id)

Source from the content-addressed store, hash-verified

167 self.total_tests_requested += 1
168
169 def test_pair(self, code_id, test_id):
170 exit_code, logs = copy_and_run_pytest(
171 args.sources_dirname,
172 args.function_name,
173 code_id,
174 test_id,
175 self.docker_execute)
176
177 if exit_code != 0:
178 logging.info(f"Test failed: code {code_id} <-> test {test_id}: exit_code={exit_code} logs={logs}")
179
180 if len(logs) == "":
181 logging.info("Test failed really badly somehow. Deleting {code_id} and {test_id} to avoid repeating this error.")
182 self.codes.remove(code_id)
183 self.tests.remove(test_id)
184 return False
185
186 logging.info(f"Test passed: code {code_id} <-> test {test_id} - Asking judge if we are done")
187
188 code = self.contents[code_id]
189 test = self.contents[test_id]
190 judge_id = self.manager.add_judge_pair_job(code, test)
191 self.pair_scores[judge_id] = (code_id, test_id, None)
192
193 return True
194
195 def handle_code(self, code_id, code, score, improved=False):
196 print(f"Task ID {code_id}: Generated code (improved={improved}) with score {score} and len={len(code)}")

Callers 2

handle_codeMethod · 0.95
handle_testMethod · 0.95

Calls 2

copy_and_run_pytestFunction · 0.85
add_judge_pair_jobMethod · 0.80

Tested by

no test coverage detected