Skip to content

Commit 1a25f05

Browse files
committed
fix: remove unnecessary Optimizer from benchmark test
The test only needs project_root, not a full Optimizer (which requires an API key). Also adds missing __init__.py to tests/benchmarks/.
1 parent 2208e8c commit 1a25f05

2 files changed

Lines changed: 3 additions & 16 deletions

File tree

tests/benchmarks/__init__.py

Whitespace-only changes.
Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,18 @@
1-
from argparse import Namespace
21
from pathlib import Path
32

43
from codeflash.discovery.functions_to_optimize import FunctionToOptimize
54
from codeflash.languages.python.context.code_context_extractor import get_code_optimization_context
65
from codeflash.models.models import FunctionParent
7-
from codeflash.optimization.optimizer import Optimizer
86

97

108
def test_benchmark_extract(benchmark) -> None:
11-
file_path = Path(__file__).parent.parent.parent.resolve() / "codeflash"
12-
opt = Optimizer(
13-
Namespace(
14-
project_root=file_path.resolve(),
15-
disable_telemetry=True,
16-
tests_root=(file_path / "tests").resolve(),
17-
test_framework="pytest",
18-
pytest_cmd="pytest",
19-
experiment_id=None,
20-
test_project_root=Path.cwd(),
21-
)
22-
)
9+
project_root = Path(__file__).parent.parent.parent.resolve() / "codeflash"
2310
function_to_optimize = FunctionToOptimize(
2411
function_name="replace_function_and_helpers_with_optimized_code",
25-
file_path=file_path / "languages" / "function_optimizer.py",
12+
file_path=project_root / "languages" / "function_optimizer.py",
2613
parents=[FunctionParent(name="FunctionOptimizer", type="ClassDef")],
2714
starting_line=None,
2815
ending_line=None,
2916
)
3017

31-
benchmark(get_code_optimization_context, function_to_optimize, opt.args.project_root)
18+
benchmark(get_code_optimization_context, function_to_optimize, project_root)

0 commit comments

Comments
 (0)