-
Notifications
You must be signed in to change notification settings - Fork 22
shorten error string, more enhancements needed #965
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
aseembits93
merged 3 commits into
feat/feedback-loop-for-unmatched-test-results
from
feat/shorten-test-feedback
Dec 15, 2025
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,11 @@ | ||
| from __future__ import annotations | ||
|
|
||
| import reprlib | ||
| import sys | ||
| from typing import TYPE_CHECKING | ||
|
|
||
| from codeflash.cli_cmds.console import logger | ||
| from codeflash.code_utils.code_utils import shorten_pytest_error | ||
| from codeflash.models.models import TestDiff, TestDiffScope, TestResults, TestType, VerificationType | ||
| from codeflash.verification.comparator import comparator | ||
|
|
||
|
|
@@ -57,11 +59,29 @@ def compare_test_results(original_results: TestResults, candidate_results: TestR | |
| if candidate_test_failures | ||
| else "" | ||
| ) | ||
| if cdd_pytest_error: | ||
| cdd_pytest_error = shorten_pytest_error(cdd_pytest_error) | ||
| original_pytest_error = ( | ||
| original_test_failures.get(original_test_result.id.test_fn_qualified_name(), "") | ||
| if original_test_failures | ||
| else "" | ||
| ) | ||
| if original_pytest_error: | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe change the var name? it's no longer the original pytest error if it's been shortened |
||
| original_pytest_error = shorten_pytest_error(original_pytest_error) | ||
| test_src_code = original_test_result.id.get_src_code(original_test_result.file_name) | ||
| test_diff = TestDiff( | ||
| scope=TestDiffScope.RETURN_VALUE, | ||
| original_value=reprlib.repr(original_test_result.return_value), | ||
| candidate_value=reprlib.repr(cdd_test_result.return_value), | ||
| test_src_code=test_src_code, | ||
| candidate_pytest_error=cdd_pytest_error, | ||
| original_pass=original_test_result.did_pass, | ||
| candidate_pass=cdd_test_result.did_pass, | ||
| original_pytest_error=original_pytest_error, | ||
| ) | ||
| if not comparator(original_test_result.return_value, cdd_test_result.return_value, superset_obj=superset_obj): | ||
| test_diff.scope = TestDiffScope.RETURN_VALUE | ||
| test_diffs.append(test_diff) | ||
|
|
||
| if not comparator(original_test_result.return_value, cdd_test_result.return_value, superset_obj=superset_obj): | ||
| test_diffs.append( | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
codeflash will optimize this away or should've