Fixes for in-code documentation
Fixes a couple of issues that slid by on review https://review.openstack.org/85651 Change-Id: I2dd19c6d0af9c7c3148811aeb8299656d1afc788
This commit is contained in:
parent
40ee25fb81
commit
89afcc3a47
@ -29,6 +29,10 @@ CONF = config.CONF
|
||||
|
||||
|
||||
def run_once(f):
|
||||
"""A decorator to ensure the decorated function is only executed once.
|
||||
|
||||
The decorated function cannot expect any arguments.
|
||||
"""
|
||||
@functools.wraps(f)
|
||||
def wrapper():
|
||||
if not wrapper.already_ran:
|
||||
@ -69,11 +73,17 @@ def _initialize_sql_session():
|
||||
def _load_sqlalchemy_models():
|
||||
"""Find all modules containing SQLAlchemy models and import them.
|
||||
|
||||
This will create more consistent, deterministic test runs because the
|
||||
database schema will be predictable. The schema is created based on the
|
||||
models already imported. This can change during the course of a test run.
|
||||
If all models are imported ahead of time then the schema will always be
|
||||
the same.
|
||||
This creates more consistent, deterministic test runs because tables
|
||||
for all core and extension models are always created in the test
|
||||
database. We ensure this by importing all modules that contain model
|
||||
definitions.
|
||||
|
||||
The database schema during test runs is created using reflection.
|
||||
Reflection is simply SQLAlchemy taking the model definitions for
|
||||
all models currently imported and making tables for each of them.
|
||||
The database schema created during test runs may vary between tests
|
||||
as more models are imported. Importing all models at the start of
|
||||
the test run avoids this problem.
|
||||
|
||||
"""
|
||||
keystone_root = os.path.normpath(os.path.join(
|
||||
|
@ -26,8 +26,8 @@ from keystone.tests import test_backend
|
||||
|
||||
class KvsIdentity(tests.TestCase, test_backend.IdentityTests):
|
||||
def setUp(self):
|
||||
# NOTE(dstanek): setup the database for subsystems that do not have a
|
||||
# KVS backend (like credentials)
|
||||
# NOTE(dstanek): setup the database for subsystems that only have a
|
||||
# SQL backend (like credentials)
|
||||
self.useFixture(database.Database())
|
||||
|
||||
super(KvsIdentity, self).setUp()
|
||||
|
Loading…
Reference in New Issue
Block a user