The oslo_db.sqlalchemy.test_base
Module¶
-
class
oslo_db.sqlalchemy.test_base.
DbFixture
(test, skip_on_unavailable_db=True)¶ Bases:
fixtures.fixture.Fixture
Basic database fixture.
Allows to run tests on various db backends, such as SQLite, MySQL and PostgreSQL. By default use sqlite backend. To override default backend uri set env variable OS_TEST_DBAPI_ADMIN_CONNECTION with database admin credentials for specific backend.
-
DBNAME
= 'openstack_citest'¶
-
DRIVER
= 'sqlite'¶
-
PASSWORD
= 'openstack_citest'¶
-
USERNAME
= 'openstack_citest'¶
-
setUp
()¶
-
-
class
oslo_db.sqlalchemy.test_base.
DbTestCase
(*args, **kwds)¶ Bases:
oslotest.base.BaseTestCase
Base class for testing of DB code.
-
SCHEMA_SCOPE
= None¶
-
SKIP_ON_UNAVAILABLE_DB
= True¶
-
generate_schema
(engine)¶ Generate schema objects to be used within a test.
The function is separate from the setUp() case as the scope of this method is controlled by the provisioning system. A test that specifies SCHEMA_SCOPE may not call this method for each test, as the schema may be maintained from a previous run.
-
resources
¶
-
setUp
()¶
-
-
class
oslo_db.sqlalchemy.test_base.
MySQLOpportunisticFixture
(test, skip_on_unavailable_db=True)¶ Bases:
oslo_db.sqlalchemy.test_base.DbFixture
-
DRIVER
= 'mysql'¶
-
-
class
oslo_db.sqlalchemy.test_base.
MySQLOpportunisticTestCase
(*args, **kwds)¶ Bases:
oslo_db.sqlalchemy.test_base.OpportunisticTestCase
-
FIXTURE
¶ alias of
MySQLOpportunisticFixture
-
-
class
oslo_db.sqlalchemy.test_base.
OpportunisticTestCase
(*args, **kwds)¶ Bases:
oslo_db.sqlalchemy.test_base.DbTestCase
Placeholder for backwards compatibility.
-
class
oslo_db.sqlalchemy.test_base.
PostgreSQLOpportunisticFixture
(test, skip_on_unavailable_db=True)¶ Bases:
oslo_db.sqlalchemy.test_base.DbFixture
-
DRIVER
= 'postgresql'¶
-
-
class
oslo_db.sqlalchemy.test_base.
PostgreSQLOpportunisticTestCase
(*args, **kwds)¶ Bases:
oslo_db.sqlalchemy.test_base.OpportunisticTestCase
-
FIXTURE
¶ alias of
PostgreSQLOpportunisticFixture
-
-
oslo_db.sqlalchemy.test_base.
backend_specific
(*dialects)¶ Decorator to skip backend specific tests on inappropriate engines.
::dialects: list of dialects names under which the test will be launched.
-
oslo_db.sqlalchemy.test_base.
optimize_db_test_loader
(file_)¶ Package level load_tests() function.
Will apply an optimizing test suite to all sub-tests, which groups DB tests and other resources appropriately.
Place this in an __init__.py package file within the root of the test suite, at the level where testresources loads it as a package:
from oslo_db.sqlalchemy import test_base load_tests = test_base.optimize_db_test_loader(__file__)
Alternatively, the directive can be placed into a test module directly.