Merge "Share one engine for more than just sqlite in-memory" into milestone-proposed
This commit is contained in:
commit
d5dcb3babf
|
@ -30,7 +30,6 @@ from keystone.common import logging
|
|||
from keystone import config
|
||||
from keystone import exception
|
||||
from keystone.openstack.common import jsonutils
|
||||
from keystone import exception
|
||||
|
||||
|
||||
CONF = config.CONF
|
||||
|
@ -98,7 +97,6 @@ def set_global_engine(engine):
|
|||
|
||||
|
||||
def get_global_engine():
|
||||
global GLOBAL_ENGINE
|
||||
return GLOBAL_ENGINE
|
||||
|
||||
|
||||
|
@ -250,6 +248,8 @@ class Base(object):
|
|||
# auto-build the db to support wsgi server w/ in-memory backend
|
||||
if allow_global_engine and CONF.sql.connection == 'sqlite://':
|
||||
ModelBase.metadata.create_all(bind=engine)
|
||||
|
||||
if allow_global_engine:
|
||||
set_global_engine(engine)
|
||||
|
||||
return engine
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
import os
|
||||
import shutil
|
||||
|
||||
from keystone.common.sql import core
|
||||
from keystone.common.sql import migration
|
||||
from keystone import config
|
||||
|
||||
|
@ -38,5 +39,7 @@ def setup_test_database():
|
|||
|
||||
|
||||
def teardown_test_database():
|
||||
core.set_global_engine(None)
|
||||
|
||||
if os.path.exists('test.db.pristine'):
|
||||
os.unlink('test.db.pristine')
|
||||
|
|
Loading…
Reference in New Issue