Skip to content

Commit 52b6019

Browse files
committed
removed walrus, removed random test before stalling test
Signed-off-by: Sai Shree Pradhan <saishree.pradhan@databricks.com>
1 parent cf89ce3 commit 52b6019

File tree

3 files changed

+39
-36
lines changed

3 files changed

+39
-36
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 -v -s
116116
check-linting:
117117
runs-on: ubuntu-latest
118118
strategy:

src/databricks/sql/telemetry/telemetry_client.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -415,14 +415,16 @@ def close(session_id_hex):
415415
"""Close and remove the telemetry client for a specific connection"""
416416

417417
with TelemetryClientFactory._lock:
418-
if (
419-
telemetry_client := TelemetryClientFactory._clients.pop(
420-
session_id_hex, None
421-
)
422-
) is not None:
418+
# if (
419+
# telemetry_client := TelemetryClientFactory._clients.pop(
420+
# session_id_hex, None
421+
# )
422+
# ) is not None:
423+
if session_id_hex in TelemetryClientFactory._clients:
423424
logger.debug(
424425
"Removing telemetry client for connection %s", session_id_hex
425426
)
427+
telemetry_client = TelemetryClientFactory._clients.pop(session_id_hex)
426428
telemetry_client.close()
427429

428430
# Shutdown executor if no more clients

tests/unit/test_client.py

Lines changed: 31 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,7 @@ def test_context_manager_closes_cursor(self):
353353

354354
@patch("%s.client.ThriftBackend" % PACKAGE_NAME)
355355
def test_context_manager_closes_connection(self, mock_client_class):
356+
print("stalling test")
356357
instance = mock_client_class.return_value
357358

358359
mock_open_session_resp = MagicMock(spec=TOpenSessionResp)()
@@ -649,36 +650,36 @@ def test_disable_pandas_respected(self, mock_thrift_backend_class):
649650

650651
mock_table.itercolumns.assert_called_once_with()
651652

652-
def test_column_name_api(self):
653-
ResultRow = Row("first_col", "second_col", "third_col")
654-
data = [
655-
ResultRow("val1", 321, 52.32),
656-
ResultRow("val2", 2321, 252.32),
657-
]
658-
659-
expected_values = [["val1", 321, 52.32], ["val2", 2321, 252.32]]
660-
661-
for (row, expected) in zip(data, expected_values):
662-
self.assertEqual(row.first_col, expected[0])
663-
self.assertEqual(row.second_col, expected[1])
664-
self.assertEqual(row.third_col, expected[2])
665-
666-
self.assertEqual(row["first_col"], expected[0])
667-
self.assertEqual(row["second_col"], expected[1])
668-
self.assertEqual(row["third_col"], expected[2])
669-
670-
self.assertEqual(row[0], expected[0])
671-
self.assertEqual(row[1], expected[1])
672-
self.assertEqual(row[2], expected[2])
673-
674-
self.assertEqual(
675-
row.asDict(),
676-
{
677-
"first_col": expected[0],
678-
"second_col": expected[1],
679-
"third_col": expected[2],
680-
},
681-
)
653+
# def test_column_name_api(self):
654+
# ResultRow = Row("first_col", "second_col", "third_col")
655+
# data = [
656+
# ResultRow("val1", 321, 52.32),
657+
# ResultRow("val2", 2321, 252.32),
658+
# ]
659+
660+
# expected_values = [["val1", 321, 52.32], ["val2", 2321, 252.32]]
661+
662+
# for (row, expected) in zip(data, expected_values):
663+
# self.assertEqual(row.first_col, expected[0])
664+
# self.assertEqual(row.second_col, expected[1])
665+
# self.assertEqual(row.third_col, expected[2])
666+
667+
# self.assertEqual(row["first_col"], expected[0])
668+
# self.assertEqual(row["second_col"], expected[1])
669+
# self.assertEqual(row["third_col"], expected[2])
670+
671+
# self.assertEqual(row[0], expected[0])
672+
# self.assertEqual(row[1], expected[1])
673+
# self.assertEqual(row[2], expected[2])
674+
675+
# self.assertEqual(
676+
# row.asDict(),
677+
# {
678+
# "first_col": expected[0],
679+
# "second_col": expected[1],
680+
# "third_col": expected[2],
681+
# },
682+
# )
682683

683684
@patch("%s.client.ThriftBackend" % PACKAGE_NAME)
684685
def test_finalizer_closes_abandoned_connection(self, mock_client_class):

0 commit comments

Comments
 (0)