@@ -23,8 +23,9 @@ def execute_test_subprocess(
2323 cmd_list : list [str ], cwd : Path , env : dict [str , str ] | None , timeout : int = 600
2424) -> subprocess .CompletedProcess :
2525 """Execute a subprocess with the given command list, working directory, environment variables, and timeout."""
26- logger .debug (f"executing test run with command: { ' ' .join (cmd_list )} " )
27- return subprocess .run (cmd_list , capture_output = True , cwd = cwd , env = env , text = True , timeout = timeout , check = False )
26+ with custom_addopts ():
27+ logger .debug (f"executing test run with command: { ' ' .join (cmd_list )} " )
28+ return subprocess .run (cmd_list , capture_output = True , cwd = cwd , env = env , text = True , timeout = timeout , check = False )
2829
2930
3031def run_behavioral_tests (
@@ -98,26 +99,24 @@ def run_behavioral_tests(
9899
99100 blocklist_args = [f"-p no:{ plugin } " for plugin in BEHAVIORAL_BLOCKLISTED_PLUGINS if plugin != "cov" ]
100101
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- )
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+ )
108108 logger .debug (
109109 f"Result return code: { results .returncode } , "
110110 f"{ 'Result stderr:' + str (results .stderr ) if results .stderr else '' } "
111111 )
112112 else :
113113 blocklist_args = [f"-p no:{ plugin } " for plugin in BEHAVIORAL_BLOCKLISTED_PLUGINS ]
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- )
114+ results = execute_test_subprocess (
115+ pytest_cmd_list + common_pytest_args + blocklist_args + result_args + test_files ,
116+ cwd = cwd ,
117+ env = pytest_test_env ,
118+ timeout = 600 , # TODO: Make this dynamic
119+ )
121120 logger .debug (
122121 f"""Result return code: { results .returncode } , { "Result stderr:" + str (results .stderr ) if results .stderr else "" } """
123122 )
@@ -195,13 +194,12 @@ def run_line_profile_tests(
195194 pytest_test_env ["PYTEST_PLUGINS" ] = "codeflash.verification.pytest_plugin"
196195 blocklist_args = [f"-p no:{ plugin } " for plugin in BENCHMARKING_BLOCKLISTED_PLUGINS ]
197196 pytest_test_env ["LINE_PROFILE" ] = "1"
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- )
197+ results = execute_test_subprocess (
198+ pytest_cmd_list + pytest_args + blocklist_args + result_args + test_files ,
199+ cwd = cwd ,
200+ env = pytest_test_env ,
201+ timeout = 600 , # TODO: Make this dynamic
202+ )
205203 else :
206204 msg = f"Unsupported test framework: { test_framework } "
207205 raise ValueError (msg )
@@ -256,13 +254,12 @@ def run_benchmarking_tests(
256254 pytest_test_env = test_env .copy ()
257255 pytest_test_env ["PYTEST_PLUGINS" ] = "codeflash.verification.pytest_plugin"
258256 blocklist_args = [f"-p no:{ plugin } " for plugin in BENCHMARKING_BLOCKLISTED_PLUGINS ]
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- )
257+ results = execute_test_subprocess (
258+ pytest_cmd_list + pytest_args + blocklist_args + result_args + test_files ,
259+ cwd = cwd ,
260+ env = pytest_test_env ,
261+ timeout = 600 , # TODO: Make this dynamic
262+ )
266263 elif test_framework == "unittest" :
267264 test_files = [file .benchmarking_file_path for file in test_paths .test_files ]
268265 result_file_path , results = run_unittest_tests (
@@ -282,8 +279,7 @@ def run_unittest_tests(
282279 log_level = ["-v" ] if verbose else []
283280 files = [str (file ) for file in test_file_paths ]
284281 output_file = ["--output-file" , str (result_file_path )]
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- )
282+ results = execute_test_subprocess (
283+ unittest_cmd_list + log_level + files + output_file , cwd = cwd , env = test_env , timeout = 600
284+ )
289285 return result_file_path , results
0 commit comments