Make sqlite in-memory-db usable to unittest

Move migrate monkey patch from nova.tests.test_migrations to
nova.db.sqlalchemy.migration

Change-Id: I018e44903558cad6311fd368787583322f962d0c
This commit is contained in:
Hengqing Hu
2012-03-08 16:43:32 +08:00
parent 07cc4d056e
commit 1f8bc92a50
4 changed files with 40 additions and 45 deletions

View File

@@ -40,6 +40,7 @@ from nova.openstack.common import cfg
from nova import utils
from nova import service
from nova.testing.fake import rabbit
from nova.tests import reset_db
from nova.virt import fake
@@ -129,8 +130,7 @@ class TestCase(unittest.TestCase):
# now that we have some required db setup for the system
# to work properly.
self.start = utils.utcnow()
shutil.copyfile(os.path.join(FLAGS.state_path, FLAGS.sqlite_clean_db),
os.path.join(FLAGS.state_path, FLAGS.sqlite_db))
reset_db()
# emulate some of the mox stuff, we can't use the metaclass
# because it screws with our generators