7 from thrift.transport
import TSocket, TTransport
8 from thrift.transport.TSocket
import TTransportException
9 from heavydb
import connect
13 heavydb_host = os.environ.get(
'HEAVYDB_HOST',
'localhost')
18 Test to see if HeavyDB running on localhost and socket open
20 socket = TSocket.TSocket(heavydb_host, 6274)
21 transport = TTransport.TBufferedTransport(socket)
26 except TTransportException:
30 @pytest.fixture(scope=
'session')
32 """Ensure a HeavyDB server is running, optionally starting one if none"""
38 subprocess.check_output(
50 'heavyai/core-os-cpu:latest',
60 @pytest.fixture(scope=
'session')
61 def con(heavydb_server):
63 Fixture to provide Connection for tests run against live HeavyDB instance
67 password=
'HyperInteractive',
77 """A magicmock for heavydb.connection.Client"""
78 return mocker.patch(
"heavydb.connection.Client")
82 """Check for the required GPU dependencies"""
84 from numba
import cuda
89 except cuda.cudadrv.error.CudaDriverError:
97 """Generate a random string sequence for use in _tests_table_no_nulls"""
100 random.choice(string.ascii_letters + string.digits)
108 table_name =
'table_{}'.format(uuid4().hex)
109 con.execute(
"drop table if exists {};".format(table_name))
114 con.execute(
"drop table if exists {};".format(table_name))