mirror of
https://github.com/codeflash-ai/codeflash-internal.git
synced 2026-05-04 18:25:18 +00:00
Merge branch 'main' into improve-github-init-actions
This commit is contained in:
commit
59935fc73b
3 changed files with 32 additions and 20 deletions
2
.github/workflows/pr_agent.yml
vendored
2
.github/workflows/pr_agent.yml
vendored
|
|
@ -14,7 +14,7 @@ jobs:
|
|||
steps:
|
||||
- name: PR Agent action step
|
||||
id: pragent
|
||||
uses: Codium-ai/pr-agent@main
|
||||
uses: qodo-ai/pr-agent@main
|
||||
env:
|
||||
OPENAI_KEY: ${{ secrets.OPENAI_KEY }}
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
|
@ -40,18 +40,13 @@ def speedup_critic(
|
|||
|
||||
def quantity_of_tests_critic(candidate_result: OptimizedCandidateResult) -> bool:
|
||||
test_results = candidate_result.behavior_test_results
|
||||
in_github_actions_mode = bool(env_utils.get_pr_number())
|
||||
|
||||
report = test_results.get_test_pass_fail_report_by_type()
|
||||
|
||||
pass_count = 0
|
||||
for test_type in report:
|
||||
pass_count += report[test_type]["passed"]
|
||||
|
||||
if in_github_actions_mode:
|
||||
if pass_count >= 4:
|
||||
return True
|
||||
elif pass_count >= 2:
|
||||
if pass_count >= 4:
|
||||
return True
|
||||
# If only one test passed, check if it's a REPLAY_TEST
|
||||
return bool(pass_count == 1 and report[TestType.REPLAY_TEST]["passed"] == 1)
|
||||
|
|
|
|||
|
|
@ -175,7 +175,25 @@ def test_generated_test_critic() -> None:
|
|||
loop_index=2,
|
||||
)
|
||||
|
||||
test_results = [test_1, test_2, test_3]
|
||||
test_7 = FunctionTestInvocation(
|
||||
id=InvocationId(
|
||||
test_module_path="",
|
||||
test_class_name="",
|
||||
test_function_name="test_7",
|
||||
function_getting_tested="sorter",
|
||||
iteration_id="",
|
||||
),
|
||||
file_name=Path("test_7"),
|
||||
did_pass=True,
|
||||
runtime=0,
|
||||
test_framework="pytest",
|
||||
test_type=TestType.EXISTING_UNIT_TEST,
|
||||
return_value=None,
|
||||
timed_out=False,
|
||||
loop_index=1,
|
||||
)
|
||||
|
||||
test_results = [test_1, test_2, test_3, test_7]
|
||||
|
||||
candidate_result = OptimizedCandidateResult(
|
||||
max_loop_count=5,
|
||||
|
|
@ -188,7 +206,7 @@ def test_generated_test_critic() -> None:
|
|||
|
||||
assert quantity_of_tests_critic(candidate_result)
|
||||
|
||||
test_results = [test_1, test_3, test_6]
|
||||
test_results = [test_1, test_2, test_3, test_6, test_7]
|
||||
|
||||
candidate_result = OptimizedCandidateResult(
|
||||
max_loop_count=5,
|
||||
|
|
@ -201,7 +219,7 @@ def test_generated_test_critic() -> None:
|
|||
|
||||
assert quantity_of_tests_critic(candidate_result)
|
||||
|
||||
test_results = [test_1, test_3, test_4]
|
||||
test_results = [test_1, test_3, test_4, test_2, test_7]
|
||||
|
||||
candidate_result = OptimizedCandidateResult(
|
||||
max_loop_count=5,
|
||||
|
|
@ -227,7 +245,7 @@ def test_generated_test_critic() -> None:
|
|||
|
||||
assert not quantity_of_tests_critic(candidate_result)
|
||||
|
||||
test_results = [test_1, test_2]
|
||||
test_results = [test_1, test_2, test_3, test_4, test_5]
|
||||
|
||||
candidate_result = OptimizedCandidateResult(
|
||||
max_loop_count=5,
|
||||
|
|
@ -323,7 +341,6 @@ def test_generated_test_critic() -> None:
|
|||
del os.environ["CODEFLASH_PR_NUMBER"]
|
||||
|
||||
|
||||
|
||||
def test_coverage_critic() -> None:
|
||||
mock_code_context = Mock(spec=CodeOptimizationContext)
|
||||
|
||||
|
|
@ -340,10 +357,10 @@ def test_coverage_critic() -> None:
|
|||
executed_lines=[10],
|
||||
unexecuted_lines=[2],
|
||||
executed_branches=[[5]],
|
||||
unexecuted_branches=[[1]]
|
||||
unexecuted_branches=[[1]],
|
||||
),
|
||||
dependent_func_coverage=None,
|
||||
status=CoverageStatus.PARSED_SUCCESSFULLY
|
||||
status=CoverageStatus.PARSED_SUCCESSFULLY,
|
||||
)
|
||||
|
||||
assert coverage_critic(passing_coverage, "pytest") is True
|
||||
|
|
@ -361,10 +378,10 @@ def test_coverage_critic() -> None:
|
|||
executed_lines=[10],
|
||||
unexecuted_lines=[2],
|
||||
executed_branches=[[5]],
|
||||
unexecuted_branches=[[1]]
|
||||
unexecuted_branches=[[1]],
|
||||
),
|
||||
dependent_func_coverage=None,
|
||||
status=CoverageStatus.PARSED_SUCCESSFULLY
|
||||
status=CoverageStatus.PARSED_SUCCESSFULLY,
|
||||
)
|
||||
|
||||
assert coverage_critic(border_coverage, "pytest") is True
|
||||
|
|
@ -382,10 +399,10 @@ def test_coverage_critic() -> None:
|
|||
executed_lines=[],
|
||||
unexecuted_lines=[10],
|
||||
executed_branches=[],
|
||||
unexecuted_branches=[[5]]
|
||||
unexecuted_branches=[[5]],
|
||||
),
|
||||
dependent_func_coverage=None,
|
||||
status=CoverageStatus.PARSED_SUCCESSFULLY
|
||||
status=CoverageStatus.PARSED_SUCCESSFULLY,
|
||||
)
|
||||
|
||||
assert coverage_critic(failing_coverage, "pytest") is False
|
||||
|
|
@ -403,10 +420,10 @@ def test_coverage_critic() -> None:
|
|||
executed_lines=[10],
|
||||
unexecuted_lines=[2],
|
||||
executed_branches=[[5]],
|
||||
unexecuted_branches=[[1]]
|
||||
unexecuted_branches=[[1]],
|
||||
),
|
||||
dependent_func_coverage=None,
|
||||
status=CoverageStatus.PARSED_SUCCESSFULLY
|
||||
status=CoverageStatus.PARSED_SUCCESSFULLY,
|
||||
)
|
||||
|
||||
assert coverage_critic(unittest_coverage, "unittest") is True
|
||||
|
|
|
|||
Loading…
Reference in a new issue