Skip to content

Commit 704a4b0

Browse files
author
Codeflash Bot
committed
shorten error string, more enhancements needed
1 parent 4976d5d commit 704a4b0

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

codeflash/code_utils/code_utils.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,10 @@ def exit_with_message(message: str, *, error_on_exit: bool = False) -> None:
362362
sys.exit(1 if error_on_exit else 0)
363363

364364

365+
def shorten_pytest_error(pytest_error_string: str) -> str:
366+
return "\n".join(re.findall(r"^[E>] +(.*)$", pytest_error_string, re.MULTILINE))
367+
368+
365369
def extract_unique_errors(pytest_output: str) -> set[str]:
366370
unique_errors = set()
367371

codeflash/verification/equivalence.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from typing import TYPE_CHECKING
55

66
from codeflash.cli_cmds.console import logger
7+
from codeflash.code_utils.code_utils import shorten_pytest_error
78
from codeflash.models.models import TestDiff, TestDiffScope, TestResults, TestType, VerificationType
89
from codeflash.verification.comparator import comparator
910

@@ -57,12 +58,15 @@ def compare_test_results(original_results: TestResults, candidate_results: TestR
5758
if candidate_test_failures
5859
else ""
5960
)
61+
if cdd_pytest_error:
62+
cdd_pytest_error = shorten_pytest_error(cdd_pytest_error)
6063
original_pytest_error = (
6164
original_test_failures.get(original_test_result.id.test_fn_qualified_name(), "")
6265
if original_test_failures
6366
else ""
6467
)
65-
68+
if original_pytest_error:
69+
original_pytest_error = shorten_pytest_error(original_pytest_error)
6670
test_src_code = original_test_result.id.get_src_code(original_test_result.file_name)
6771
test_diff = TestDiff(
6872
scope=TestDiffScope.RETURN_VALUE,

0 commit comments

Comments
 (0)