@@ -127,7 +127,8 @@ class PySQLRetryTestsMixin:
127127 "_retry_delay_default" : 0.5 ,
128128 }
129129
130- def test_retry_urllib3_settings_are_honored (self ):
130+ @patch ("databricks.sql.telemetry.telemetry_client.TelemetryClient._send_telemetry" )
131+ def test_retry_urllib3_settings_are_honored (self , mock_send_telemetry ):
131132 """Databricks overrides some of urllib3's configuration. This tests confirms that what configuration
132133 we DON'T override is preserved in urllib3's internals
133134 """
@@ -147,7 +148,8 @@ def test_retry_urllib3_settings_are_honored(self):
147148 assert rp .read == 11
148149 assert rp .redirect == 12
149150
150- def test_oserror_retries (self ):
151+ @patch ("databricks.sql.telemetry.telemetry_client.TelemetryClient._send_telemetry" )
152+ def test_oserror_retries (self , mock_send_telemetry ):
151153 """If a network error occurs during make_request, the request is retried according to policy"""
152154 with patch (
153155 "urllib3.connectionpool.HTTPSConnectionPool._validate_conn" ,
@@ -159,7 +161,8 @@ def test_oserror_retries(self):
159161
160162 assert mock_validate_conn .call_count == 6
161163
162- def test_retry_max_count_not_exceeded (self ):
164+ @patch ("databricks.sql.telemetry.telemetry_client.TelemetryClient._send_telemetry" )
165+ def test_retry_max_count_not_exceeded (self , mock_send_telemetry ):
163166 """GIVEN the max_attempts_count is 5
164167 WHEN the server sends nothing but 429 responses
165168 THEN the connector issues six request (original plus five retries)
@@ -171,7 +174,8 @@ def test_retry_max_count_not_exceeded(self):
171174 pass
172175 assert mock_obj .return_value .getresponse .call_count == 6
173176
174- def test_retry_exponential_backoff (self ):
177+ @patch ("databricks.sql.telemetry.telemetry_client.TelemetryClient._send_telemetry" )
178+ def test_retry_exponential_backoff (self , mock_send_telemetry ):
175179 """GIVEN the retry policy is configured for reasonable exponential backoff
176180 WHEN the server sends nothing but 429 responses with retry-afters
177181 THEN the connector will use those retry-afters values as floor
@@ -338,7 +342,8 @@ def test_retry_abort_close_operation_on_404(self, caplog):
338342 "Operation was canceled by a prior request" in caplog .text
339343 )
340344
341- def test_retry_max_redirects_raises_too_many_redirects_exception (self ):
345+ @patch ("databricks.sql.telemetry.telemetry_client.TelemetryClient._send_telemetry" )
346+ def test_retry_max_redirects_raises_too_many_redirects_exception (self , mock_send_telemetry ):
342347 """GIVEN the connector is configured with a custom max_redirects
343348 WHEN the DatabricksRetryPolicy is created
344349 THEN the connector raises a MaxRedirectsError if that number is exceeded
@@ -362,7 +367,8 @@ def test_retry_max_redirects_raises_too_many_redirects_exception(self):
362367 # Total call count should be 2 (original + 1 retry)
363368 assert mock_obj .return_value .getresponse .call_count == expected_call_count
364369
365- def test_retry_max_redirects_unset_doesnt_redirect_forever (self ):
370+ @patch ("databricks.sql.telemetry.telemetry_client.TelemetryClient._send_telemetry" )
371+ def test_retry_max_redirects_unset_doesnt_redirect_forever (self , mock_send_telemetry ):
366372 """GIVEN the connector is configured without a custom max_redirects
367373 WHEN the DatabricksRetryPolicy is used
368374 THEN the connector raises a MaxRedirectsError if that number is exceeded
0 commit comments