From d17dfe65550d393739dc50a1eedfe65903a81d28 Mon Sep 17 00:00:00 2001 From: Yuriy Taraday Date: Fri, 7 Dec 2012 22:32:52 +0400 Subject: [PATCH] Import pysqlite2 if sqlite3 is not available. Otherwise test_import_legacy fails on import. Change-Id: I902493f5b726f5bc9e23e776598b8938c85e622c --- tests/test_import_legacy.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/test_import_legacy.py b/tests/test_import_legacy.py index 8a37551d6c..0c37e808c2 100644 --- a/tests/test_import_legacy.py +++ b/tests/test_import_legacy.py @@ -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