Skip to content

Commit 80730f9

Browse files
committed
modified paths in test
1 parent 83f1c1c commit 80730f9

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

tests/test_trace_benchmarks.py

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -32,34 +32,36 @@ def test_trace_benchmarks():
3232
# Assert the length of function calls
3333
assert len(function_calls) == 7, f"Expected 6 function calls, but got {len(function_calls)}"
3434

35+
bubble_sort_path = (project_root / "bubble_sort_codeflash_trace.py").as_posix()
36+
process_and_bubble_sort_path = (project_root / "process_and_bubble_sort_codeflash_trace.py").as_posix()
3537
# Expected function calls
3638
expected_calls = [
3739
("__init__", "Sorter", "code_to_optimize.bubble_sort_codeflash_trace",
38-
f"{project_root / 'code_to_optimize/bubble_sort_codeflash_trace.py'}",
40+
f"{bubble_sort_path}",
3941
"test_class_sort", "test_benchmark_bubble_sort.py", 20),
4042

4143
("sort_class", "Sorter", "code_to_optimize.bubble_sort_codeflash_trace",
42-
f"{project_root / 'code_to_optimize/bubble_sort_codeflash_trace.py'}",
44+
f"{bubble_sort_path}",
4345
"test_class_sort", "test_benchmark_bubble_sort.py", 18),
4446

4547
("sort_static", "Sorter", "code_to_optimize.bubble_sort_codeflash_trace",
46-
f"{project_root / 'code_to_optimize/bubble_sort_codeflash_trace.py'}",
48+
f"{bubble_sort_path}",
4749
"test_class_sort", "test_benchmark_bubble_sort.py", 19),
4850

4951
("sorter", "Sorter", "code_to_optimize.bubble_sort_codeflash_trace",
50-
f"{project_root / 'code_to_optimize/bubble_sort_codeflash_trace.py'}",
52+
f"{bubble_sort_path}",
5153
"test_class_sort", "test_benchmark_bubble_sort.py", 17),
5254

5355
("sorter", "", "code_to_optimize.bubble_sort_codeflash_trace",
54-
f"{project_root / 'code_to_optimize/bubble_sort_codeflash_trace.py'}",
56+
f"{bubble_sort_path}",
5557
"test_sort", "test_benchmark_bubble_sort.py", 7),
5658

5759
("compute_and_sort", "", "code_to_optimize.process_and_bubble_sort_codeflash_trace",
58-
f"{project_root / 'code_to_optimize/process_and_bubble_sort_codeflash_trace.py'}",
60+
f"{process_and_bubble_sort_path}",
5961
"test_compute_and_sort", "test_process_and_sort.py", 4),
6062

6163
("sorter", "", "code_to_optimize.bubble_sort_codeflash_trace",
62-
f"{project_root / 'code_to_optimize/bubble_sort_codeflash_trace.py'}",
64+
f"{bubble_sort_path}",
6365
"test_no_func", "test_process_and_sort.py", 8),
6466
]
6567
for idx, (actual, expected) in enumerate(zip(function_calls, expected_calls)):
@@ -86,7 +88,7 @@ def test_trace_benchmarks():
8688
trace_file_path = r"{output_file.as_posix()}"
8789
8890
def test_code_to_optimize_bubble_sort_codeflash_trace_Sorter_sorter():
89-
for args_pkl, kwargs_pkl in get_next_arg_and_return(trace_file=trace_file_path, function_name="sorter", file_name=r"/Users/alvinryanputra/cf/codeflash/code_to_optimize/bubble_sort_codeflash_trace.py", class_name="Sorter", num_to_get=100):
91+
for args_pkl, kwargs_pkl in get_next_arg_and_return(trace_file=trace_file_path, function_name="sorter", file_name=r"{bubble_sort_path}", class_name="Sorter", num_to_get=100):
9092
args = pickle.loads(args_pkl)
9193
kwargs = pickle.loads(kwargs_pkl)
9294
function_name = "sorter"
@@ -99,21 +101,21 @@ def test_code_to_optimize_bubble_sort_codeflash_trace_Sorter_sorter():
99101
ret = instance.sorter(*args[1:], **kwargs)
100102
101103
def test_code_to_optimize_bubble_sort_codeflash_trace_Sorter_sort_class():
102-
for args_pkl, kwargs_pkl in get_next_arg_and_return(trace_file=trace_file_path, function_name="sort_class", file_name=r"/Users/alvinryanputra/cf/codeflash/code_to_optimize/bubble_sort_codeflash_trace.py", class_name="Sorter", num_to_get=100):
104+
for args_pkl, kwargs_pkl in get_next_arg_and_return(trace_file=trace_file_path, function_name="sort_class", file_name=r"{bubble_sort_path}", class_name="Sorter", num_to_get=100):
103105
args = pickle.loads(args_pkl)
104106
kwargs = pickle.loads(kwargs_pkl)
105107
if not args:
106108
raise ValueError("No arguments provided for the method.")
107109
ret = code_to_optimize_bubble_sort_codeflash_trace_Sorter.sort_class(*args[1:], **kwargs)
108110
109111
def test_code_to_optimize_bubble_sort_codeflash_trace_Sorter_sort_static():
110-
for args_pkl, kwargs_pkl in get_next_arg_and_return(trace_file=trace_file_path, function_name="sort_static", file_name=r"/Users/alvinryanputra/cf/codeflash/code_to_optimize/bubble_sort_codeflash_trace.py", class_name="Sorter", num_to_get=100):
112+
for args_pkl, kwargs_pkl in get_next_arg_and_return(trace_file=trace_file_path, function_name="sort_static", file_name=r"{bubble_sort_path}", class_name="Sorter", num_to_get=100):
111113
args = pickle.loads(args_pkl)
112114
kwargs = pickle.loads(kwargs_pkl)
113115
ret = code_to_optimize_bubble_sort_codeflash_trace_Sorter.sort_static(*args, **kwargs)
114116
115117
def test_code_to_optimize_bubble_sort_codeflash_trace_Sorter___init__():
116-
for args_pkl, kwargs_pkl in get_next_arg_and_return(trace_file=trace_file_path, function_name="__init__", file_name=r"/Users/alvinryanputra/cf/codeflash/code_to_optimize/bubble_sort_codeflash_trace.py", class_name="Sorter", num_to_get=100):
118+
for args_pkl, kwargs_pkl in get_next_arg_and_return(trace_file=trace_file_path, function_name="__init__", file_name=r"{bubble_sort_path}", class_name="Sorter", num_to_get=100):
117119
args = pickle.loads(args_pkl)
118120
kwargs = pickle.loads(kwargs_pkl)
119121
function_name = "__init__"
@@ -141,7 +143,7 @@ def test_code_to_optimize_bubble_sort_codeflash_trace_Sorter___init__():
141143
trace_file_path = r"{output_file}"
142144
143145
def test_code_to_optimize_bubble_sort_codeflash_trace_sorter():
144-
for args_pkl, kwargs_pkl in get_next_arg_and_return(trace_file=trace_file_path, function_name="sorter", file_name=r"/Users/alvinryanputra/cf/codeflash/code_to_optimize/bubble_sort_codeflash_trace.py", num_to_get=100):
146+
for args_pkl, kwargs_pkl in get_next_arg_and_return(trace_file=trace_file_path, function_name="sorter", file_name=r"{bubble_sort_path}", num_to_get=100):
145147
args = pickle.loads(args_pkl)
146148
kwargs = pickle.loads(kwargs_pkl)
147149
ret = code_to_optimize_bubble_sort_codeflash_trace_sorter(*args, **kwargs)
@@ -150,5 +152,5 @@ def test_code_to_optimize_bubble_sort_codeflash_trace_sorter():
150152
assert test_sort_path.read_text("utf-8").strip()==test_sort_code.strip()
151153
finally:
152154
# cleanup
153-
if tests_root.exists():
154-
shutil.rmtree(tests_root, ignore_errors=True)
155+
shutil.rmtree(tests_root)
156+
pass

0 commit comments

Comments
 (0)