Skip to content

Commit 9539992

Browse files
committed
testing latest commit from pyhive pr
1 parent 1a79455 commit 9539992

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

pyhive/tests/test_hive.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from __future__ import absolute_import
88
from __future__ import unicode_literals
99

10+
import pkgutil
1011
import contextlib
1112
import datetime
1213
import os
@@ -204,13 +205,14 @@ def test_custom_transport(self):
204205
sasl_auth = 'PLAIN'
205206

206207
def get_installed_sasl():
207-
try:
208+
if pkgutil.find_loader('sasl'):
208209
return hive.get_sasl_client(host='localhost', sasl_auth=sasl_auth, username='test_username', password='x')
209210
# The sasl library is available
210-
except ImportError:
211+
elif pkgutil.find_loader('puresasl'):
211212
# Fallback to pure-sasl library
212213
return hive.get_pure_sasl_client(host='localhost', sasl_auth=sasl_auth, username='test_username', password='x')
213-
214+
else:
215+
raise ValueError("No suitable SASL module available. Please install either sasl or pure-sasl.")
214216

215217
transport = thrift_sasl.TSaslClientTransport(get_installed_sasl, sasl_auth, socket)
216218
conn = hive.connect(thrift_transport=transport)

0 commit comments

Comments
 (0)