|
34 | 34 | cleanup_paths, |
35 | 35 | create_rank_dictionary_compact, |
36 | 36 | diff_length, |
| 37 | + extract_unique_errors, |
37 | 38 | file_name_from_test_module_name, |
38 | 39 | get_run_tmp_file, |
39 | 40 | module_name_from_file_path, |
@@ -1569,11 +1570,14 @@ def establish_original_code_baseline( |
1569 | 1570 | ) |
1570 | 1571 | if not behavioral_results: |
1571 | 1572 | logger.warning( |
1572 | | - f"force_lsp|Couldn't run any tests for original function {self.function_to_optimize.function_name}. SKIPPING OPTIMIZING THIS FUNCTION." |
| 1573 | + f"force_lsp|Couldn't run any tests for original function {self.function_to_optimize.function_name}. Skipping optimization." |
1573 | 1574 | ) |
1574 | 1575 | console.rule() |
1575 | 1576 | return Failure("Failed to establish a baseline for the original code - bevhavioral tests failed.") |
1576 | 1577 | if not coverage_critic(coverage_results, self.args.test_framework): |
| 1578 | + did_pass_all_tests = all(result.did_pass for result in behavioral_results) |
| 1579 | + if not did_pass_all_tests: |
| 1580 | + return Failure("Tests failed to pass for the original code.") |
1577 | 1581 | return Failure( |
1578 | 1582 | f"Test coverage is {coverage_results.coverage}%, which is below the required threshold of {COVERAGE_THRESHOLD}%." |
1579 | 1583 | ) |
@@ -1601,7 +1605,7 @@ def establish_original_code_baseline( |
1601 | 1605 | ) |
1602 | 1606 |
|
1603 | 1607 | try: |
1604 | | - benchmarking_results, _ = self.run_and_parse_tests( |
| 1608 | + benchmarking_results = self.run_and_parse_tests( |
1605 | 1609 | testing_type=TestingMode.PERFORMANCE, |
1606 | 1610 | test_env=test_env, |
1607 | 1611 | test_files=self.test_files, |
@@ -1937,6 +1941,12 @@ def run_and_parse_tests( |
1937 | 1941 | f"stdout: {run_result.stdout}\n" |
1938 | 1942 | f"stderr: {run_result.stderr}\n" |
1939 | 1943 | ) |
| 1944 | + |
| 1945 | + if is_LSP_enabled(): |
| 1946 | + unique_errors = extract_unique_errors(run_result.stdout) |
| 1947 | + if unique_errors: |
| 1948 | + lsp_log(LspCodeMessage(code="\n".join(unique_errors), file_name="errors")) |
| 1949 | + |
1940 | 1950 | if "ModuleNotFoundError" in run_result.stdout: |
1941 | 1951 | from rich.text import Text |
1942 | 1952 |
|
|
0 commit comments