File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2223,42 +2223,8 @@ def test_make_call_retry(self, mock_request):
22232223
22242224 self .assertEqual (cm2 .exception .args [0 ], "not working" )
22252225 log_content = "\n " .join (cm1 .output )
2226- for i in [1 , 2 ]:
2227- self .assertIn (
2228- f"Request failed, attempt { i } of 3. Retrying" ,
2229- log_content ,
2230- )
2231- self .assertIn (
2232- "Request failed. Giving up after 3 attempts." ,
2233- log_content ,
2234- )
2235-
2236- # Then, make the exception happening only once and prove the
2237- # retry works
2238- def my_side_effect (* args , ** kwargs ):
2239- try :
2240- if my_side_effect .counter < 1 :
2241- raise Exception ("not working" )
2242-
2243- return mock .DEFAULT
2244- finally :
2245- my_side_effect .counter += 1
2246-
2247- my_side_effect .counter = 0
2248- mock_request .side_effect = my_side_effect
2249- with self .assertLogs ("shotgun_api3" , level = "DEBUG" ) as cm :
2250- self .assertIsInstance (
2251- self .sg .info (),
2252- dict ,
2253- )
2254-
2255- log_content = "\n " .join (cm .output )
22562226 self .assertIn (
2257- "Request failed, attempt 1 of 3. Retrying" ,
2258- log_content ,
2259- )
2260- self .assertNotIn (
2261- "Request failed, attempt 2 of 3. Retrying" ,
2227+ "Request failed. Reason: not working" ,
22622228 log_content ,
22632229 )
22642230
Original file line number Diff line number Diff line change @@ -330,17 +330,9 @@ def test_network_retry(self):
330330 with mock .patch ("time.sleep" ) as mock_sleep :
331331 self .assertRaises (httplib2 .HttpLib2Error , self .sg .info )
332332 self .assertTrue (
333- self .sg .config . max_rpc_attempts == self . sg . _http_request . call_count ,
333+ self .sg ._http_request . call_count == 1 ,
334334 "Call is repeated" ,
335335 )
336- # Ensure that sleep was called with the retry interval between each attempt
337- attempt_interval = self .sg .config .rpc_attempt_interval / 1000.0
338- calls = [mock .callargs (((attempt_interval ,), {}))]
339- calls *= self .sg .config .max_rpc_attempts - 1
340- self .assertTrue (
341- mock_sleep .call_args_list == calls ,
342- "Call is repeated at correct interval." ,
343- )
344336
345337 def test_set_retry_interval (self ):
346338 """Setting the retry interval through parameter and environment variable works."""
You can’t perform that action at this time.
0 commit comments