From d1bc895a53dd5468b9ed70238a63b3750b62d445 Mon Sep 17 00:00:00 2001 From: Saurabh Misra Date: Thu, 19 Jun 2025 21:04:19 -0700 Subject: [PATCH 1/2] - trace also if seen only once - trace also if method of a class --- codeflash/tracer.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/codeflash/tracer.py b/codeflash/tracer.py index 2acf3b9f0..001dd9309 100644 --- a/codeflash/tracer.py +++ b/codeflash/tracer.py @@ -263,7 +263,7 @@ def __exit__( if self.function_count[ str(function.file_name) + ":" - + (function.class_name + ":" if function.class_name else "") + + (function.class_name + "." if function.class_name else "") + function.function_name ] > 0 @@ -353,7 +353,7 @@ def tracer_logic(self, frame: FrameType, event: str) -> None: # noqa: PLR0911 return if function_qualified_name not in self.function_count: # seeing this function for the first time - self.function_count[function_qualified_name] = 0 + self.function_count[function_qualified_name] = 1 file_valid = filter_files_optimized( file_path=file_name, tests_root=Path(self.config["tests_root"]), From 9efe253e3ad9aade736e7739e372780568ff2575 Mon Sep 17 00:00:00 2001 From: Kevin Turcios Date: Thu, 19 Jun 2025 22:39:59 -0700 Subject: [PATCH 2/2] expected unit tests == 2 since both funcA and test_threadpool were traced, not just funca --- tests/scripts/end_to_end_test_tracer_replay.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/scripts/end_to_end_test_tracer_replay.py b/tests/scripts/end_to_end_test_tracer_replay.py index a2506fd99..99ffc6dfd 100644 --- a/tests/scripts/end_to_end_test_tracer_replay.py +++ b/tests/scripts/end_to_end_test_tracer_replay.py @@ -8,7 +8,7 @@ def run_test(expected_improvement_pct: int) -> bool: config = TestConfig( trace_mode=True, min_improvement_x=0.1, - expected_unit_tests=1, + expected_unit_tests=2, coverage_expectations=[ CoverageExpectation(function_name="funcA", expected_coverage=100.0, expected_lines=[5, 6, 7, 8, 10, 13]) ],