Skip to content

Commit 14433c4

Browse files
committed
remove debugging
Signed-off-by: Sai Shree Pradhan <saishree.pradhan@databricks.com>
1 parent 9fa5a89 commit 14433c4

File tree

4 files changed

+4
-41
lines changed

4 files changed

+4
-41
lines changed

.github/workflows/code-quality-checks.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ jobs:
112112
# run test suite
113113
#----------------------------------------------
114114
- name: Run tests
115-
run: poetry run python -m pytest tests/unit
115+
run: poetry run python -m pytest tests/unit
116116
check-linting:
117117
runs-on: ubuntu-latest
118118
strategy:

src/databricks/sql/telemetry/telemetry_client.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,7 @@ def _install_exception_hook(cls):
387387
def _handle_unhandled_exception(cls, exc_type, exc_value, exc_traceback):
388388
"""Handle unhandled exceptions by sending telemetry and flushing thread pool"""
389389
logger.debug("Handling unhandled exception: %s", exc_type.__name__)
390+
390391
clients_to_close = list(cls._clients.values())
391392
for client in clients_to_close:
392393
client.close()
@@ -403,6 +404,7 @@ def initialize_telemetry_client(
403404
host_url,
404405
):
405406
"""Initialize a telemetry client for a specific connection if telemetry is enabled"""
407+
406408
try:
407409
with TelemetryClientFactory._lock:
408410
TelemetryClientFactory._initialize()
@@ -450,6 +452,7 @@ def get_telemetry_client(session_id_hex):
450452
@staticmethod
451453
def close(session_id_hex):
452454
"""Close and remove the telemetry client for a specific connection"""
455+
453456
with TelemetryClientFactory._lock:
454457
if (
455458
telemetry_client := TelemetryClientFactory._clients.pop(

src/databricks/sql/thrift_backend.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
)
4343
from databricks.sql.types import SSLOptions
4444

45-
4645
logger = logging.getLogger(__name__)
4746

4847
unsafe_logger = logging.getLogger("databricks.sql.unsafe")

tests/unit/test_client.py

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -83,44 +83,6 @@ class ClientTestSuite(unittest.TestCase):
8383
"access_token": "tok",
8484
}
8585

86-
# def setUp(self):
87-
# """Set up connection tracking before each test"""
88-
# self.tracked_connections = []
89-
90-
# # Store the original connect function
91-
# self.original_connect = databricks.sql.connect
92-
93-
# def patched_connect(*args, **kwargs):
94-
# """Wrapper that tracks all created connections"""
95-
# conn = self.original_connect(*args, **kwargs)
96-
97-
# # Skip tracking for finalizer tests to allow garbage collection
98-
# if not (hasattr(self, '_testMethodName') and 'finalizer' in self._testMethodName):
99-
# self.tracked_connections.append(conn)
100-
101-
# return conn
102-
103-
# # Apply the patch to track connections
104-
# self.connect_patcher = patch('databricks.sql.connect', patched_connect)
105-
# self.connect_patcher.start()
106-
107-
# def tearDown(self):
108-
# """Clean up connections after each test"""
109-
# # Close all tracked connections
110-
# for conn in self.tracked_connections:
111-
# try:
112-
# if hasattr(conn, 'open') and conn.open:
113-
# conn.close()
114-
# except Exception as e:
115-
# # Log the error but don't fail the test
116-
# print(f"Warning: Error closing connection in tearDown: {e}")
117-
118-
# # Stop the connect patcher
119-
# self.connect_patcher.stop()
120-
121-
# # Clear the tracked connections list
122-
# self.tracked_connections.clear()
123-
12486
@patch("%s.client.ThriftBackend" % PACKAGE_NAME)
12587
def test_close_uses_the_correct_session_id(self, mock_client_class):
12688
instance = mock_client_class.return_value
@@ -790,7 +752,6 @@ def test_access_current_query_id(self):
790752

791753
cursor.close()
792754
self.assertIsNone(cursor.query_id)
793-
connection.close()
794755

795756
def test_cursor_close_handles_exception(self):
796757
"""Test that Cursor.close() handles exceptions from close_command properly."""

0 commit comments

Comments
 (0)