Skip to content

Commit cc1a0b9

Browse files
committed
fix tests failing
1 parent 9139c43 commit cc1a0b9

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

.github/workflows/unit-tests.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ jobs:
3232
run: uvx poetry install --with dev
3333

3434
- name: Unit tests
35-
run: uvx poetry run pytest tests/ --cov --cov-report=xml
35+
run: uvx poetry run pytest tests/ --cov --cov-report=xml -vv
36+
# run: uvx poetry run pytest tests/ -vv
3637

3738
- name: Upload coverage reports to Codecov
3839
uses: codecov/codecov-action@v5

codeflash/verification/_auditwall.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ def accept(event: str, args: tuple) -> None:
1919
pass
2020

2121

22+
args_allow_list = {".coverage", "matplotlib.rc", "codeflash"}
23+
24+
2225
def reject(event: str, args: tuple) -> None:
2326
msg = f'codeflash has detected: {event}{args}".'
2427
raise SideEffectDetectedError(msg)
@@ -40,7 +43,6 @@ def check_open(event: str, args: tuple) -> None:
4043

4144

4245
def check_msvcrt_open(event: str, args: tuple) -> None:
43-
print(args)
4446
(handle, flags) = args
4547
if flags & _BLOCKED_OPEN_FLAGS:
4648
msg = f"codeflash has detected: {event}({', '.join(map(repr, args))})."
@@ -66,8 +68,18 @@ def check_subprocess(event: str, args: tuple) -> None:
6668
reject(event, args)
6769

6870

71+
def handle_os_remove(event: str, args: tuple) -> None:
72+
filename = str(args[0])
73+
if any(pattern in filename for pattern in args_allow_list):
74+
accept(event, args)
75+
else:
76+
reject(event, args)
77+
78+
6979
def check_sqlite_connect(event: str, args: tuple) -> None:
70-
if any("codeflash_" in arg for arg in args):
80+
if (
81+
event == "sqlite3.connect" and any(pattern in str(args[0]) for pattern in args_allow_list)
82+
) or event == "sqlite3.connect/handle":
7183
accept(event, args)
7284
else:
7385
reject(event, args)
@@ -79,6 +91,7 @@ def check_sqlite_connect(event: str, args: tuple) -> None:
7991
"msvcrt.open_osfhandle": check_msvcrt_open,
8092
"sqlite3.connect": check_sqlite_connect,
8193
"sqlite3.connect/handle": check_sqlite_connect,
94+
"os.remove": handle_os_remove,
8295
}
8396

8497

0 commit comments

Comments
 (0)