55from databricks .sql .auth .retry import DatabricksRetryPolicy , RequestHistory , CommandType
66from urllib3 .exceptions import MaxRetryError
77
8+
89class TestRetry :
910 @pytest .fixture ()
1011 def retry_policy (self ) -> DatabricksRetryPolicy :
@@ -33,7 +34,9 @@ def test_sleep__no_retry_after(self, t_mock, retry_policy, error_history):
3334 retry_policy .history = [error_history , error_history ]
3435 retry_policy .sleep (HTTPResponse (status = 503 ))
3536
36- expected_backoff_time = self .calculate_backoff_time (0 , retry_policy .delay_min , retry_policy .delay_max )
37+ expected_backoff_time = self .calculate_backoff_time (
38+ 0 , retry_policy .delay_min , retry_policy .delay_max
39+ )
3740 t_mock .assert_called_with (expected_backoff_time )
3841
3942 @patch ("time.sleep" )
@@ -50,10 +53,16 @@ def test_sleep__no_retry_after_header__multiple_retries(self, t_mock, retry_poli
5053
5154 expected_backoff_times = []
5255 for attempt in range (num_attempts ):
53- expected_backoff_times .append (self .calculate_backoff_time (attempt , retry_policy .delay_min , retry_policy .delay_max ))
56+ expected_backoff_times .append (
57+ self .calculate_backoff_time (
58+ attempt , retry_policy .delay_min , retry_policy .delay_max
59+ )
60+ )
5461
5562 # Asserts if the sleep value was called in the expected order
56- t_mock .assert_has_calls ([call (expected_time ) for expected_time in expected_backoff_times ])
63+ t_mock .assert_has_calls (
64+ [call (expected_time ) for expected_time in expected_backoff_times ]
65+ )
5766
5867 @patch ("time.sleep" )
5968 def test_excessive_retry_attempts_error (self , t_mock , retry_policy ):
0 commit comments