-
Notifications
You must be signed in to change notification settings - Fork 22
[LSP] log the errors from the failed behavior test results (CF-757) #830
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
Changes from all commits
77d102f
f8f5590
f983f08
83f1dea
ff924f4
b8f3093
b2bb31e
a893d92
c45f7c4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -30,10 +30,10 @@ | |
| replace_function_definitions_in_module, | ||
| ) | ||
| from codeflash.code_utils.code_utils import ( | ||
| ImportErrorPattern, | ||
| cleanup_paths, | ||
| create_rank_dictionary_compact, | ||
| diff_length, | ||
| extract_unique_errors, | ||
| file_name_from_test_module_name, | ||
| get_run_tmp_file, | ||
| module_name_from_file_path, | ||
|
|
@@ -1576,11 +1576,14 @@ def establish_original_code_baseline( | |
| ) | ||
| if not behavioral_results: | ||
| logger.warning( | ||
| f"force_lsp|Couldn't run any tests for original function {self.function_to_optimize.function_name}. SKIPPING OPTIMIZING THIS FUNCTION." | ||
| f"force_lsp|Couldn't run any tests for original function {self.function_to_optimize.function_name}. Skipping optimization." | ||
| ) | ||
| console.rule() | ||
| return Failure("Failed to establish a baseline for the original code - bevhavioral tests failed.") | ||
| if not coverage_critic(coverage_results, self.args.test_framework): | ||
| did_pass_all_tests = all(result.did_pass for result in behavioral_results) | ||
| if not did_pass_all_tests: | ||
| return Failure("Tests failed to pass for the original code.") | ||
|
Comment on lines
+1584
to
+1586
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. we're not quite good with our tests to where this is going to work smoothly, currently we have tests that fail frequently 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. so you are saying if the coverage wasn't enough, and some tests failed, 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. yeah that's correct, if we don't have good tests then the optimizations will fail, let's merge this in and I'll work on this |
||
| return Failure( | ||
| f"Test coverage is {coverage_results.coverage}%, which is below the required threshold of {COVERAGE_THRESHOLD}%." | ||
| ) | ||
|
|
@@ -1944,12 +1947,19 @@ def run_and_parse_tests( | |
| f"stdout: {run_result.stdout}\n" | ||
| f"stderr: {run_result.stderr}\n" | ||
| ) | ||
| if "ModuleNotFoundError" in run_result.stdout: | ||
|
|
||
| unique_errors = extract_unique_errors(run_result.stdout) | ||
|
|
||
| if unique_errors: | ||
| from rich.text import Text | ||
|
|
||
| match = ImportErrorPattern.search(run_result.stdout).group() | ||
| panel = Panel(Text.from_markup(f"⚠️ {match} ", style="bold red"), expand=False) | ||
| console.print(panel) | ||
| for error in unique_errors: | ||
| if is_LSP_enabled(): | ||
| lsp_log(LspCodeMessage(code=error, file_name="errors")) | ||
| else: | ||
| panel = Panel(Text.from_markup(f"⚠️ {error} ", style="bold red"), expand=False) | ||
| console.print(panel) | ||
|
|
||
| if testing_type in {TestingMode.BEHAVIOR, TestingMode.PERFORMANCE}: | ||
| results, coverage_results = parse_test_results( | ||
| test_xml_path=result_file_path, | ||
|
|
||
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 should've found an optimization here