@@ -208,7 +208,6 @@ def call(*popenargs,
208
208
poll_procs = poll_procs or []
209
209
if not suppress_output_info :
210
210
print (f"Start subprocess with call({ popenargs } , { kwargs } )" )
211
- actual_timeout = get_pytest_timeout (timeout )
212
211
with popen (* popenargs ,
213
212
start_new_session = start_new_session ,
214
213
suppress_output_info = True ,
@@ -219,7 +218,7 @@ def call(*popenargs,
219
218
return p .wait (timeout = spin_time )
220
219
except subprocess .TimeoutExpired :
221
220
elapsed_time += spin_time
222
- if actual_timeout is not None and elapsed_time >= actual_timeout :
221
+ if timeout is not None and elapsed_time >= timeout :
223
222
raise
224
223
for p_poll in poll_procs :
225
224
if p_poll .poll () is None :
@@ -240,13 +239,12 @@ def check_call(*popenargs, **kwargs):
240
239
241
240
def check_output (* popenargs , timeout = None , start_new_session = True , ** kwargs ):
242
241
print (f"Start subprocess with check_output({ popenargs } , { kwargs } )" )
243
- actual_timeout = get_pytest_timeout (timeout )
244
242
with Popen (* popenargs ,
245
243
stdout = subprocess .PIPE ,
246
244
start_new_session = start_new_session ,
247
245
** kwargs ) as process :
248
246
try :
249
- stdout , stderr = process .communicate (None , timeout = actual_timeout )
247
+ stdout , stderr = process .communicate (None , timeout = timeout )
250
248
except subprocess .TimeoutExpired as exc :
251
249
cleanup_process_tree (process , start_new_session )
252
250
if is_windows ():
@@ -321,26 +319,3 @@ def check_call_negative_test(*popenargs, **kwargs):
321
319
f"Subprocess expected to fail with check_call_negative_test({ popenargs } , { kwargs } ), but passed."
322
320
)
323
321
raise subprocess .CalledProcessError (1 , cmd )
324
-
325
-
326
- def get_pytest_timeout (timeout = None ):
327
- try :
328
- import pytest
329
- marks = None
330
- try :
331
- current_item = pytest .current_test
332
- if hasattr (current_item , 'iter_markers' ):
333
- marks = list (current_item .iter_markers ('timeout' ))
334
- except (AttributeError , NameError ):
335
- pass
336
-
337
- if marks and len (marks ) > 0 :
338
- timeout_mark = marks [0 ]
339
- timeout_pytest = timeout_mark .args [0 ] if timeout_mark .args else None
340
- if timeout_pytest and isinstance (timeout_pytest , (int , float )):
341
- return max (30 , int (timeout_pytest * 0.9 ))
342
-
343
- except (ImportError , Exception ) as e :
344
- print (f"Error getting pytest timeout: { e } " )
345
-
346
- return timeout
0 commit comments