Merge "Fix sql_upgrade tests run by themselves"

This commit is contained in:
Jenkins 2014-04-26 01:49:09 +00:00 committed by Gerrit Code Review
commit 6935b18ea5
2 changed files with 4 additions and 2 deletions

View File

@ -60,7 +60,7 @@ def _setup_database(extensions=None):
@run_once @run_once
def _initialize_sql_session(): def initialize_sql_session():
# Make sure the DB is located in the correct location, in this case set # Make sure the DB is located in the correct location, in this case set
# the default value, as this should be able to be overridden in some # the default value, as this should be able to be overridden in some
# test cases. # test cases.
@ -110,7 +110,7 @@ class Database(fixtures.Fixture):
def __init__(self, extensions=None): def __init__(self, extensions=None):
super(Database, self).__init__() super(Database, self).__init__()
self._extensions = extensions self._extensions = extensions
_initialize_sql_session() initialize_sql_session()
_load_sqlalchemy_models() _load_sqlalchemy_models()
def setUp(self): def setUp(self):

View File

@ -48,6 +48,7 @@ from keystone.openstack.common.db.sqlalchemy import migration
from keystone.openstack.common.db.sqlalchemy import session as db_session from keystone.openstack.common.db.sqlalchemy import session as db_session
from keystone import tests from keystone import tests
from keystone.tests import default_fixtures from keystone.tests import default_fixtures
from keystone.tests.ksfixtures import database
CONF = config.CONF CONF = config.CONF
@ -129,6 +130,7 @@ class SqlMigrateBase(tests.SQLDriverOverrides, tests.TestCase):
def setUp(self): def setUp(self):
super(SqlMigrateBase, self).setUp() super(SqlMigrateBase, self).setUp()
database.initialize_sql_session()
conn_str = CONF.database.connection conn_str = CONF.database.connection
if (conn_str != tests.IN_MEM_DB_CONN_STRING and if (conn_str != tests.IN_MEM_DB_CONN_STRING and
conn_str.startswith('sqlite') and conn_str.startswith('sqlite') and