Skip to content

Commit 1ef954a

Browse files
committed
fix for E2E
1 parent d5b3b87 commit 1ef954a

8 files changed

+6
-14
lines changed

codeflash/optimization/function_optimizer.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1591,7 +1591,6 @@ def establish_original_code_baseline(
15911591
) -> Result[tuple[OriginalCodeBaseline, list[str]], str]:
15921592
line_profile_results = {"timings": {}, "unit": 0, "str_out": ""}
15931593
# For the original function - run the tests and get the runtime, plus coverage
1594-
test_framework = "pytest" # Always use pytest for all tests
15951594
success = True
15961595

15971596
test_env = self.get_test_env(codeflash_loop_index=0, codeflash_test_iteration=0, codeflash_tracer_disable=1)

codeflash/verification/verification_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ class TestConfig:
7575
pytest_cmd: str = "pytest"
7676
benchmark_tests_root: Optional[Path] = None
7777
use_cache: bool = True
78-
78+
7979
@property
8080
def test_framework(self) -> str:
8181
"""Always returns 'pytest' as we use pytest for all tests."""

tests/scripts/end_to_end_test_benchmark_sort.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ def run_test(expected_improvement_pct: int) -> bool:
1010
file_path=pathlib.Path("bubble_sort.py"),
1111
function_name="sorter",
1212
benchmarks_root=cwd / "tests" / "pytest" / "benchmarks",
13-
test_framework="pytest",
1413
min_improvement_x=0.70,
1514
coverage_expectations=[
1615
CoverageExpectation(

tests/scripts/end_to_end_test_bubblesort_pytest.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ def run_test(expected_improvement_pct: int) -> bool:
88
config = TestConfig(
99
file_path="bubble_sort.py",
1010
function_name="sorter",
11-
test_framework="pytest",
1211
min_improvement_x=0.70,
1312
coverage_expectations=[
1413
CoverageExpectation(

tests/scripts/end_to_end_test_bubblesort_unittest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
def run_test(expected_improvement_pct: int) -> bool:
88
config = TestConfig(
9-
file_path="bubble_sort.py", function_name="sorter", test_framework="unittest", min_improvement_x=0.30
9+
file_path="bubble_sort.py", function_name="sorter", min_improvement_x=0.30
1010
)
1111
cwd = (pathlib.Path(__file__).parent.parent.parent / "code_to_optimize").resolve()
1212
return run_codeflash_command(cwd, config, expected_improvement_pct)

tests/scripts/end_to_end_test_init_optimization.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ def run_test(expected_improvement_pct: int) -> bool:
88
config = TestConfig(
99
file_path="remove_control_chars.py",
1010
function_name="CharacterRemover.remove_control_characters",
11-
test_framework="pytest",
1211
min_improvement_x=0.1,
1312
coverage_expectations=[
1413
CoverageExpectation(

tests/scripts/end_to_end_test_topological_sort_worktree.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ def run_test(expected_improvement_pct: int) -> bool:
88
config = TestConfig(
99
file_path="topological_sort.py",
1010
function_name="Graph.topologicalSort",
11-
test_framework="pytest",
1211
min_improvement_x=0.05,
1312
use_worktree=True,
1413
coverage_expectations=[

tests/scripts/end_to_end_test_utilities.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ class TestConfig:
2121
# Make file_path optional when trace_mode is True
2222
file_path: Optional[pathlib.Path] = None
2323
function_name: Optional[str] = None
24-
test_framework: Optional[str] = None
2524
expected_unit_tests: Optional[int] = None
2625
min_improvement_x: float = 0.1
2726
trace_mode: bool = False
@@ -86,7 +85,7 @@ def run_codeflash_command(
8685

8786
path_to_file = cwd / config.file_path
8887
file_contents = path_to_file.read_text("utf-8")
89-
test_root = cwd / "tests" / (config.test_framework or "")
88+
test_root = cwd / "tests" / "pytest" # Always use pytest
9089

9190
command = build_command(cwd, config, test_root, config.benchmarks_root if config.benchmarks_root else None)
9291
env = os.environ.copy()
@@ -129,10 +128,8 @@ def build_command(
129128

130129
if config.function_name:
131130
base_command.extend(["--function", config.function_name])
132-
if config.test_framework:
133-
base_command.extend(
134-
["--test-framework", config.test_framework, "--tests-root", str(test_root), "--module-root", str(cwd)]
135-
)
131+
# Always use pytest - test framework is specified via tests-root and module-root
132+
base_command.extend(["--tests-root", str(test_root), "--module-root", str(cwd)])
136133
if benchmarks_root:
137134
base_command.extend(["--benchmark", "--benchmarks-root", str(benchmarks_root)])
138135
if config.use_worktree:
@@ -190,7 +187,7 @@ def validate_stdout_in_candidate(stdout: str, expected_in_stdout: list[str]) ->
190187

191188

192189
def run_trace_test(cwd: pathlib.Path, config: TestConfig, expected_improvement_pct: int) -> bool:
193-
test_root = cwd / "tests" / (config.test_framework or "")
190+
test_root = cwd / "tests" / "pytest" # Always use pytest
194191
clear_directory(test_root)
195192
command = ["uv", "run", "--no-project", "-m", "codeflash.main", "optimize", "workload.py"]
196193
env = os.environ.copy()

0 commit comments

Comments
 (0)