File tree Expand file tree Collapse file tree 2 files changed +14
-12
lines changed
src/databricks/sql/telemetry Expand file tree Collapse file tree 2 files changed +14
-12
lines changed Original file line number Diff line number Diff line change @@ -398,7 +398,9 @@ def close_telemetry_client(session_id_hex):
398398 """Remove the telemetry client for a specific connection"""
399399 global _initialized , _executor
400400 with _lock :
401- if (telemetry_client := _clients .pop (session_id_hex , None )) is not None :
401+ # if (telemetry_client := _clients.pop(session_id_hex, None)) is not None:
402+ if session_id_hex in _clients :
403+ telemetry_client = _clients .pop (session_id_hex )
402404 logger .debug ("Removing telemetry client for connection %s" , session_id_hex )
403405 telemetry_client .close ()
404406
Original file line number Diff line number Diff line change @@ -497,17 +497,17 @@ def test_version_is_canonical(self):
497497 )
498498 self .assertIsNotNone (re .match (canonical_version_re , version ))
499499
500- # @patch("%s.client.ThriftBackend" % PACKAGE_NAME)
501- # def test_configuration_passthrough(self, mock_client_class):
502- # mock_session_config = Mock()
503- # databricks.sql.connect(
504- # session_configuration=mock_session_config, **self.DUMMY_CONNECTION_ARGS
505- # )
506-
507- # self.assertEqual(
508- # mock_client_class.return_value.open_session.call_args[0][0],
509- # mock_session_config,
510- # )
500+ @patch ("%s.client.ThriftBackend" % PACKAGE_NAME )
501+ def test_configuration_passthrough (self , mock_client_class ):
502+ mock_session_config = Mock ()
503+ databricks .sql .connect (
504+ session_configuration = mock_session_config , ** self .DUMMY_CONNECTION_ARGS
505+ )
506+
507+ self .assertEqual (
508+ mock_client_class .return_value .open_session .call_args [0 ][0 ],
509+ mock_session_config ,
510+ )
511511
512512 @patch ("%s.client.ThriftBackend" % PACKAGE_NAME )
513513 def test_initial_namespace_passthrough (self , mock_client_class ):
You can’t perform that action at this time.
0 commit comments