Import pysqlite2 if sqlite3 is not available.
Otherwise test_import_legacy fails on import. Change-Id: I902493f5b726f5bc9e23e776598b8938c85e622c
This commit is contained in:
parent
bf4b9f4987
commit
d17dfe6555
|
@ -16,8 +16,10 @@
|
|||
|
||||
import os
|
||||
|
||||
import sqlite3
|
||||
#import sqlalchemy
|
||||
try:
|
||||
import sqlite3 as dbapi
|
||||
except ImportError:
|
||||
from pysqlite2 import dbapi2 as dbapi
|
||||
|
||||
from keystone.catalog.backends import templated as catalog_templated
|
||||
from keystone.common.sql import legacy
|
||||
|
@ -52,7 +54,7 @@ class ImportLegacy(test.TestCase):
|
|||
except OSError:
|
||||
pass
|
||||
script_str = open(sql_path).read().strip()
|
||||
conn = sqlite3.connect(db_path)
|
||||
conn = dbapi.connect(db_path)
|
||||
conn.executescript(script_str)
|
||||
conn.commit()
|
||||
return db_path
|
||||
|
|
Loading…
Reference in New Issue