66from typing import TYPE_CHECKING
77
88from codeflash .cli_cmds .console import logger
9- from codeflash .code_utils .code_utils import get_run_tmp_file
9+ from codeflash .code_utils .code_utils import custom_addopts , get_run_tmp_file
1010from codeflash .code_utils .compat import IS_POSIX , SAFE_SYS_EXECUTABLE
1111from codeflash .code_utils .config_consts import TOTAL_LOOPING_TIME
1212from codeflash .code_utils .coverage_utils import prepare_coverage_files
@@ -97,24 +97,27 @@ def run_behavioral_tests(
9797 coverage_cmd .extend (shlex .split (pytest_cmd , posix = IS_POSIX )[1 :])
9898
9999 blocklist_args = [f"-p no:{ plugin } " for plugin in BEHAVIORAL_BLOCKLISTED_PLUGINS if plugin != "cov" ]
100- results = execute_test_subprocess (
101- coverage_cmd + common_pytest_args + blocklist_args + result_args + test_files ,
102- cwd = cwd ,
103- env = pytest_test_env ,
104- timeout = 600 ,
105- )
100+
101+ with custom_addopts ():
102+ results = execute_test_subprocess (
103+ coverage_cmd + common_pytest_args + blocklist_args + result_args + test_files ,
104+ cwd = cwd ,
105+ env = pytest_test_env ,
106+ timeout = 600 ,
107+ )
106108 logger .debug (
107109 f"Result return code: { results .returncode } , "
108110 f"{ 'Result stderr:' + str (results .stderr ) if results .stderr else '' } "
109111 )
110112 else :
111113 blocklist_args = [f"-p no:{ plugin } " for plugin in BEHAVIORAL_BLOCKLISTED_PLUGINS ]
112- results = execute_test_subprocess (
113- pytest_cmd_list + common_pytest_args + blocklist_args + result_args + test_files ,
114- cwd = cwd ,
115- env = pytest_test_env ,
116- timeout = 600 , # TODO: Make this dynamic
117- )
114+ with custom_addopts ():
115+ results = execute_test_subprocess (
116+ pytest_cmd_list + common_pytest_args + blocklist_args + result_args + test_files ,
117+ cwd = cwd ,
118+ env = pytest_test_env ,
119+ timeout = 600 , # TODO: Make this dynamic
120+ )
118121 logger .debug (
119122 f"""Result return code: { results .returncode } , { "Result stderr:" + str (results .stderr ) if results .stderr else "" } """
120123 )
@@ -192,12 +195,13 @@ def run_line_profile_tests(
192195 pytest_test_env ["PYTEST_PLUGINS" ] = "codeflash.verification.pytest_plugin"
193196 blocklist_args = [f"-p no:{ plugin } " for plugin in BENCHMARKING_BLOCKLISTED_PLUGINS ]
194197 pytest_test_env ["LINE_PROFILE" ] = "1"
195- results = execute_test_subprocess (
196- pytest_cmd_list + pytest_args + blocklist_args + result_args + test_files ,
197- cwd = cwd ,
198- env = pytest_test_env ,
199- timeout = 600 , # TODO: Make this dynamic
200- )
198+ with custom_addopts ():
199+ results = execute_test_subprocess (
200+ pytest_cmd_list + pytest_args + blocklist_args + result_args + test_files ,
201+ cwd = cwd ,
202+ env = pytest_test_env ,
203+ timeout = 600 , # TODO: Make this dynamic
204+ )
201205 else :
202206 msg = f"Unsupported test framework: { test_framework } "
203207 raise ValueError (msg )
@@ -252,13 +256,13 @@ def run_benchmarking_tests(
252256 pytest_test_env = test_env .copy ()
253257 pytest_test_env ["PYTEST_PLUGINS" ] = "codeflash.verification.pytest_plugin"
254258 blocklist_args = [f"-p no:{ plugin } " for plugin in BENCHMARKING_BLOCKLISTED_PLUGINS ]
255-
256- results = execute_test_subprocess (
257- pytest_cmd_list + pytest_args + blocklist_args + result_args + test_files ,
258- cwd = cwd ,
259- env = pytest_test_env ,
260- timeout = 600 , # TODO: Make this dynamic
261- )
259+ with custom_addopts ():
260+ results = execute_test_subprocess (
261+ pytest_cmd_list + pytest_args + blocklist_args + result_args + test_files ,
262+ cwd = cwd ,
263+ env = pytest_test_env ,
264+ timeout = 600 , # TODO: Make this dynamic
265+ )
262266 elif test_framework == "unittest" :
263267 test_files = [file .benchmarking_file_path for file in test_paths .test_files ]
264268 result_file_path , results = run_unittest_tests (
@@ -278,8 +282,8 @@ def run_unittest_tests(
278282 log_level = ["-v" ] if verbose else []
279283 files = [str (file ) for file in test_file_paths ]
280284 output_file = ["--output-file" , str (result_file_path )]
281-
282- results = execute_test_subprocess (
283- unittest_cmd_list + log_level + files + output_file , cwd = cwd , env = test_env , timeout = 600
284- )
285+ with custom_addopts ():
286+ results = execute_test_subprocess (
287+ unittest_cmd_list + log_level + files + output_file , cwd = cwd , env = test_env , timeout = 600
288+ )
285289 return result_file_path , results
0 commit comments