Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
singlestore-labs
GitHub Repository: singlestore-labs/singlestoredb-python
Path: blob/main/singlestoredb/tests/test_dbapi.py
469 views
1
# type: ignore
2
import os
3
4
import singlestoredb as s2
5
from . import utils
6
from singlestoredb.mysql.tests.thirdparty.test_MySQLdb import test_MySQLdb_dbapi20
7
8
9
class TestDBAPI(test_MySQLdb_dbapi20.test_MySQLdb):
10
11
driver = s2
12
13
dbname: str = ''
14
dbexisted: bool = False
15
16
@classmethod
17
def setUpClass(cls):
18
sql_file = os.path.join(os.path.dirname(__file__), 'empty.sql')
19
cls.dbname, cls.dbexisted = utils.load_sql(sql_file)
20
21
@classmethod
22
def tearDownClass(cls):
23
if not cls.dbexisted:
24
utils.drop_database(cls.dbname)
25
26
def _connect(self):
27
return s2.connect(database=type(self).dbname)
28
29