|
1 | | -from argparse import Namespace |
2 | 1 | from pathlib import Path |
3 | 2 |
|
4 | 3 | from codeflash.discovery.functions_to_optimize import FunctionToOptimize |
5 | 4 | from codeflash.languages.python.context.code_context_extractor import get_code_optimization_context |
6 | 5 | from codeflash.models.models import FunctionParent |
7 | | -from codeflash.optimization.optimizer import Optimizer |
8 | 6 |
|
9 | 7 |
|
10 | 8 | 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" |
23 | 10 | function_to_optimize = FunctionToOptimize( |
24 | 11 | 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", |
26 | 13 | parents=[FunctionParent(name="FunctionOptimizer", type="ClassDef")], |
27 | 14 | starting_line=None, |
28 | 15 | ending_line=None, |
29 | 16 | ) |
30 | 17 |
|
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