File tree Expand file tree Collapse file tree 1 file changed +15
-12
lines changed Expand file tree Collapse file tree 1 file changed +15
-12
lines changed Original file line number Diff line number Diff line change @@ -200,22 +200,23 @@ def _softened(dut_ssh):
200200 return _softened
201201
202202
203- def retry (retries ):
203+ def retry (limit ):
204204 def decorator (fn ):
205205 @wraps (fn )
206206 def wrapper (* args , ** kwargs ):
207- retries_ = retries
207+ attempt , limit_ = 0 , limit
208208 result = None
209- while retries_ :
209+ while attempt < limit_ :
210210 try :
211211 result = fn (* args , ** kwargs )
212212 break
213213 except Exception as e :
214- retries_ - = 1
214+ attempt + = 1
215215 logging .error (
216- "An error occurred in %s, retries left %d: %s" ,
216+ "An error occurred in %s, attempt %d of %d: %s" ,
217217 fn .__name__ ,
218- retries_ ,
218+ attempt ,
219+ limit_ ,
219220 e ,
220221 )
221222 return result
@@ -325,13 +326,15 @@ def create_ssh_fixture(name):
325326 @pytest .fixture (scope = "session" , name = f"{ name } _ssh" )
326327 def _ssh (request ):
327328 ssh = _CLI_wrapper (f"ssh://{ request .getfixturevalue (f'{ name } _hostname' )} " )
328- if ssh . cli_flavor == "mos" :
329- # do not break the fixture if SSH failed
330- # pass the failure into the test
331- try :
329+ # do not break the fixture if SSH failed
330+ # pass the failure into the test
331+ try :
332+ if ssh . cli_flavor == "mos" :
332333 ssh .sendcmd ("enable" )
333- except AttributeError :
334- pass
334+ # Disable pagination
335+ ssh .sendcmd ("terminal length 0" )
336+ except AttributeError :
337+ pass
335338 yield ssh
336339
337340 return _ssh
You can’t perform that action at this time.
0 commit comments