Skip to content

Commit 76cb2a5

Browse files
committed
cleanup test_framework here
1 parent acff586 commit 76cb2a5

File tree

2 files changed

+3
-11
lines changed

2 files changed

+3
-11
lines changed

codeflash/code_utils/instrument_existing_tests.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ def __init__(
7070
self,
7171
function: FunctionToOptimize,
7272
module_path: str,
73-
test_framework: str,
7473
call_positions: list[CodePosition],
7574
mode: TestingMode = TestingMode.BEHAVIOR,
7675
) -> None:
@@ -79,7 +78,6 @@ def __init__(
7978
self.class_name = None
8079
self.only_function_name = function.function_name
8180
self.module_path = module_path
82-
self.test_framework = test_framework
8381
self.call_positions = call_positions
8482
if len(function.parents) == 1 and function.parents[0].type == "ClassDef":
8583
self.class_name = function.top_level_parent_name
@@ -475,7 +473,6 @@ def __init__(
475473
self,
476474
function: FunctionToOptimize,
477475
module_path: str,
478-
test_framework: str,
479476
call_positions: list[CodePosition],
480477
mode: TestingMode = TestingMode.BEHAVIOR,
481478
) -> None:
@@ -484,7 +481,6 @@ def __init__(
484481
self.class_name = None
485482
self.only_function_name = function.function_name
486483
self.module_path = module_path
487-
self.test_framework = test_framework
488484
self.call_positions = call_positions
489485
self.did_instrument = False
490486
# Track function call count per test function
@@ -639,7 +635,6 @@ def inject_async_profiling_into_existing_test(
639635
call_positions: list[CodePosition],
640636
function_to_optimize: FunctionToOptimize,
641637
tests_project_root: Path,
642-
test_framework: str,
643638
mode: TestingMode = TestingMode.BEHAVIOR,
644639
) -> tuple[bool, str | None]:
645640
"""Inject profiling for async function calls by setting environment variables before each call."""
@@ -657,7 +652,7 @@ def inject_async_profiling_into_existing_test(
657652
import_visitor.visit(tree)
658653
func = import_visitor.imported_as
659654

660-
async_instrumenter = AsyncCallInstrumenter(func, test_module_path, test_framework, call_positions, mode=mode)
655+
async_instrumenter = AsyncCallInstrumenter(func, test_module_path, call_positions, mode=mode)
661656
tree = async_instrumenter.visit(tree)
662657

663658
if not async_instrumenter.did_instrument:
@@ -675,12 +670,11 @@ def inject_profiling_into_existing_test(
675670
call_positions: list[CodePosition],
676671
function_to_optimize: FunctionToOptimize,
677672
tests_project_root: Path,
678-
test_framework: str,
679673
mode: TestingMode = TestingMode.BEHAVIOR,
680674
) -> tuple[bool, str | None]:
681675
if function_to_optimize.is_async:
682676
return inject_async_profiling_into_existing_test(
683-
test_path, call_positions, function_to_optimize, tests_project_root, test_framework, mode
677+
test_path, call_positions, function_to_optimize, tests_project_root, mode
684678
)
685679

686680
with test_path.open(encoding="utf8") as f:
@@ -696,7 +690,7 @@ def inject_profiling_into_existing_test(
696690
import_visitor.visit(tree)
697691
func = import_visitor.imported_as
698692

699-
tree = InjectPerfOnly(func, test_module_path, test_framework, call_positions, mode=mode).visit(tree)
693+
tree = InjectPerfOnly(func, test_module_path, call_positions, mode=mode).visit(tree)
700694
new_imports = [
701695
ast.Import(names=[ast.alias(name="time")]),
702696
ast.Import(names=[ast.alias(name="gc")]),

codeflash/optimization/function_optimizer.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1053,7 +1053,6 @@ def instrument_existing_tests(self, function_to_all_tests: dict[str, set[Functio
10531053
call_positions=[test.position for test in tests_in_file_list],
10541054
function_to_optimize=self.function_to_optimize,
10551055
tests_project_root=self.test_cfg.tests_project_rootdir,
1056-
test_framework="pytest",
10571056
)
10581057
if not success:
10591058
continue
@@ -1063,7 +1062,6 @@ def instrument_existing_tests(self, function_to_all_tests: dict[str, set[Functio
10631062
call_positions=[test.position for test in tests_in_file_list],
10641063
function_to_optimize=self.function_to_optimize,
10651064
tests_project_root=self.test_cfg.tests_project_rootdir,
1066-
test_framework="pytest",
10671065
)
10681066
if not success:
10691067
continue

0 commit comments

Comments
 (0)