Skip to content

Commit e274a06

Browse files
Merge pull request #178 from codeflash-ai/disable-more-pytest-plugins
add more pytest plugins to blocklist
2 parents f99a1e5 + d19ddee commit e274a06

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

codeflash/verification/parse_test_output.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,13 +107,19 @@ def parse_sqlite_test_results(sqlite_file_path: Path, test_files: TestFiles, tes
107107
logger.warning(f"No test results for {sqlite_file_path} found.")
108108
console.rule()
109109
return test_results
110+
db = None
110111
try:
111112
db = sqlite3.connect(sqlite_file_path)
112113
cur = db.cursor()
113114
data = cur.execute(
114115
"SELECT test_module_path, test_class_name, test_function_name, "
115116
"function_getting_tested, loop_index, iteration_id, runtime, return_value,verification_type FROM test_results"
116117
).fetchall()
118+
except Exception as e:
119+
logger.warning(f"Failed to parse test results from {sqlite_file_path}. Exception: {e}")
120+
if db is not None:
121+
db.close()
122+
return test_results
117123
finally:
118124
db.close()
119125
for val in data:

codeflash/verification/test_runner.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
if TYPE_CHECKING:
1616
from codeflash.models.models import TestFiles
1717

18-
BEHAVIORAL_BLOCKLISTED_PLUGINS = ["benchmark"]
19-
BENCHMARKING_BLOCKLISTED_PLUGINS = ["codspeed", "cov", "benchmark", "profiling"]
18+
BEHAVIORAL_BLOCKLISTED_PLUGINS = ["benchmark", "codspeed", "xdist", "sugar"]
19+
BENCHMARKING_BLOCKLISTED_PLUGINS = ["codspeed", "cov", "benchmark", "profiling", "xdist", "sugar"]
2020

2121

2222
def execute_test_subprocess(
@@ -141,6 +141,7 @@ def run_behavioral_tests(
141141
coverage_config_file if enable_coverage else None,
142142
)
143143

144+
144145
def run_line_profile_tests(
145146
test_paths: TestFiles,
146147
pytest_cmd: str,
@@ -154,7 +155,6 @@ def run_line_profile_tests(
154155
pytest_min_loops: int = 5,
155156
pytest_max_loops: int = 100_000,
156157
line_profiler_output_file: Path | None = None,
157-
158158
) -> tuple[Path, subprocess.CompletedProcess]:
159159
if test_framework == "pytest":
160160
pytest_cmd_list = (
@@ -191,7 +191,7 @@ def run_line_profile_tests(
191191
pytest_test_env = test_env.copy()
192192
pytest_test_env["PYTEST_PLUGINS"] = "codeflash.verification.pytest_plugin"
193193
blocklist_args = [f"-p no:{plugin}" for plugin in BENCHMARKING_BLOCKLISTED_PLUGINS]
194-
pytest_test_env["LINE_PROFILE"]="1"
194+
pytest_test_env["LINE_PROFILE"] = "1"
195195
results = execute_test_subprocess(
196196
pytest_cmd_list + pytest_args + blocklist_args + result_args + test_files,
197197
cwd=cwd,
@@ -203,6 +203,7 @@ def run_line_profile_tests(
203203
raise ValueError(msg)
204204
return line_profiler_output_file, results
205205

206+
206207
def run_benchmarking_tests(
207208
test_paths: TestFiles,
208209
pytest_cmd: str,

0 commit comments

Comments
 (0)