Skip to content

Commit

Permalink
testing latest commit from pyhive pr
Browse files Browse the repository at this point in the history
  • Loading branch information
mdeshmu committed Jun 5, 2023
1 parent 1a79455 commit 9539992
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions pyhive/tests/test_hive.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from __future__ import absolute_import
from __future__ import unicode_literals

import pkgutil
import contextlib
import datetime
import os
Expand Down Expand Up @@ -204,13 +205,14 @@ def test_custom_transport(self):
sasl_auth = 'PLAIN'

def get_installed_sasl():
try:
if pkgutil.find_loader('sasl'):
return hive.get_sasl_client(host='localhost', sasl_auth=sasl_auth, username='test_username', password='x')
# The sasl library is available
except ImportError:
elif pkgutil.find_loader('puresasl'):
# Fallback to pure-sasl library
return hive.get_pure_sasl_client(host='localhost', sasl_auth=sasl_auth, username='test_username', password='x')

else:
raise ValueError("No suitable SASL module available. Please install either sasl or pure-sasl.")

transport = thrift_sasl.TSaslClientTransport(get_installed_sasl, sasl_auth, socket)
conn = hive.connect(thrift_transport=transport)
Expand Down

0 comments on commit 9539992

Please sign in to comment.