Skip to content

Commit 9139c43

Browse files
committed
fix tests
1 parent 414ac44 commit 9139c43

File tree

6 files changed

+32
-4
lines changed

6 files changed

+32
-4
lines changed

codeflash/cli_cmds/console.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import logging
44
from contextlib import contextmanager
55
from itertools import cycle
6-
from typing import TYPE_CHECKING, Generator
6+
from typing import TYPE_CHECKING
77

88
from rich.console import Console
99
from rich.logging import RichHandler
@@ -13,6 +13,8 @@
1313
from codeflash.cli_cmds.logging_config import BARE_LOGGING_FORMAT
1414

1515
if TYPE_CHECKING:
16+
from collections.abc import Generator
17+
1618
from rich.progress import TaskID
1719

1820
DEBUG_MODE = logging.getLogger().getEffectiveLevel() == logging.DEBUG

codeflash/verification/_auditwall.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def check_subprocess(event: str, args: tuple) -> None:
6767

6868

6969
def check_sqlite_connect(event: str, args: tuple) -> None:
70-
if "codeflash_" in args[0]:
70+
if any("codeflash_" in arg for arg in args):
7171
accept(event, args)
7272
else:
7373
reject(event, args)
@@ -78,6 +78,7 @@ def check_sqlite_connect(event: str, args: tuple) -> None:
7878
"subprocess.Popen": check_subprocess,
7979
"msvcrt.open_osfhandle": check_msvcrt_open,
8080
"sqlite3.connect": check_sqlite_connect,
81+
"sqlite3.connect/handle": check_sqlite_connect,
8182
}
8283

8384

tests/test_instrument_all_and_run.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ def test_sort():
156156
test_type=test_type,
157157
original_file_path=test_path,
158158
benchmarking_file_path=test_path_perf,
159+
original_source=code,
159160
)
160161
]
161162
)
@@ -328,6 +329,7 @@ def test_sort():
328329
test_type=test_type,
329330
original_file_path=test_path,
330331
benchmarking_file_path=test_path_perf,
332+
original_source=code,
331333
)
332334
]
333335
)
@@ -423,6 +425,7 @@ def sorter(self, arr):
423425
test_type=test_type,
424426
original_file_path=test_path,
425427
benchmarking_file_path=test_path_perf,
428+
original_source=code,
426429
)
427430
]
428431
)

tests/test_instrument_tests.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,7 @@ def test_sort():
413413
test_type=test_type,
414414
original_file_path=test_path,
415415
benchmarking_file_path=test_path_perf,
416+
original_source=code,
416417
)
417418
]
418419
)
@@ -608,6 +609,7 @@ def test_sort_parametrized(input, expected_output):
608609
test_type=test_type,
609610
original_file_path=test_path,
610611
benchmarking_file_path=test_path_perf,
612+
original_source=code,
611613
)
612614
]
613615
)
@@ -847,6 +849,7 @@ def test_sort_parametrized_loop(input, expected_output):
847849
test_type=TestType.EXISTING_UNIT_TEST,
848850
)
849851
],
852+
original_source=code,
850853
)
851854
]
852855
)
@@ -1156,6 +1159,7 @@ def test_sort():
11561159
test_type=TestType.EXISTING_UNIT_TEST,
11571160
)
11581161
],
1162+
original_source=code,
11591163
)
11601164
]
11611165
)
@@ -1425,6 +1429,7 @@ def test_sort(self):
14251429
test_type=TestType.EXISTING_UNIT_TEST,
14261430
)
14271431
],
1432+
original_source=code,
14281433
)
14291434
]
14301435
)
@@ -1672,6 +1677,7 @@ def test_sort(self, input, expected_output):
16721677
test_type=TestType.EXISTING_UNIT_TEST,
16731678
)
16741679
],
1680+
original_source=code,
16751681
)
16761682
]
16771683
)
@@ -1923,6 +1929,7 @@ def test_sort(self):
19231929
test_type=TestType.EXISTING_UNIT_TEST,
19241930
)
19251931
],
1932+
original_source=code,
19261933
)
19271934
]
19281935
)
@@ -2172,6 +2179,7 @@ def test_sort(self, input, expected_output):
21722179
test_type=TestType.EXISTING_UNIT_TEST,
21732180
)
21742181
],
2182+
original_source=code,
21752183
)
21762184
]
21772185
)

tests/test_instrumentation_run_results_aiservice.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ def test_single_element_list():
162162
test_type=test_type,
163163
original_file_path=test_path,
164164
benchmarking_file_path=test_path_perf,
165+
original_source=fto_path.read_text("utf-8"),
165166
)
166167
]
167168
)
@@ -298,6 +299,7 @@ def test_single_element_list():
298299
test_type=test_type,
299300
original_file_path=test_path,
300301
benchmarking_file_path=test_path_perf,
302+
original_source=fto_path.read_text("utf-8"),
301303
)
302304
]
303305
)

tests/test_test_runner.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,13 @@ def test_sort(self):
3636

3737
with tempfile.NamedTemporaryFile(prefix="test_xx", suffix=".py", dir=cur_dir_path) as fp:
3838
test_files = TestFiles(
39-
test_files=[TestFile(instrumented_behavior_file_path=Path(fp.name), test_type=TestType.EXISTING_UNIT_TEST)]
39+
test_files=[
40+
TestFile(
41+
instrumented_behavior_file_path=Path(fp.name),
42+
test_type=TestType.EXISTING_UNIT_TEST,
43+
original_source=code,
44+
)
45+
]
4046
)
4147
fp.write(code.encode("utf-8"))
4248
fp.flush()
@@ -80,7 +86,13 @@ def test_sort():
8086

8187
with tempfile.NamedTemporaryFile(prefix="test_xx", suffix=".py", dir=cur_dir_path) as fp:
8288
test_files = TestFiles(
83-
test_files=[TestFile(instrumented_behavior_file_path=Path(fp.name), test_type=TestType.EXISTING_UNIT_TEST)]
89+
test_files=[
90+
TestFile(
91+
instrumented_behavior_file_path=Path(fp.name),
92+
test_type=TestType.EXISTING_UNIT_TEST,
93+
original_source=code,
94+
)
95+
]
8496
)
8597
fp.write(code.encode("utf-8"))
8698
fp.flush()

0 commit comments

Comments
 (0)