Merge pull request #1412 from codeflash-ai/minor-fixes-investigating-langflow

minor improvements when investigating langflow
This commit is contained in:
Saurabh Misra 2025-01-15 15:15:28 -08:00 committed by GitHub
commit 31b4028ff2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 7 deletions

View file

@ -70,8 +70,7 @@ def discover_tests_pytest(
logger.exception(f"Failed to discover tests: {e}")
exitcode = -1
finally:
with Path.open(tmp_pickle_path, "w") as f:
pass
tmp_pickle_path.unlink(missing_ok=True)
if exitcode != 0:
if exitcode == 2 and "ERROR collecting" in result.stdout:
# Pattern matches "===== ERRORS =====" (any number of =) and captures everything after
@ -102,7 +101,7 @@ def discover_tests_pytest(
test_type = TestType.EXISTING_UNIT_TEST
test_obj = TestsInFile(
test_file=test["test_file"],
test_file=Path(test["test_file"]),
test_class=test["test_class"],
test_function=test["test_function"],
test_type=test_type,
@ -278,7 +277,7 @@ def process_test_files(
try:
definition = name.goto(follow_imports=True, follow_builtin_imports=False)
except Exception as e:
logger.exception(str(e))
logger.debug(str(e))
continue
if definition and definition[0].type == "function":
definition_path = str(definition[0].module_path)

View file

@ -201,9 +201,6 @@ def get_functions_to_optimize(
filtered_modified_functions, functions_count = filter_functions(
functions, test_cfg.tests_root, ignore_paths, project_root, module_root
)
filtered_modified_functions, functions_count = filter_functions(
functions, test_cfg.tests_root, ignore_paths, project_root, module_root
)
logger.info(f"Found {functions_count} function{'s' if functions_count > 1 else ''} to optimize")
return filtered_modified_functions, functions_count