test: Rename Database fixture to DatabaseFixture

Make it a little more obvious what this is.

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Change-Id: I5297a81d319ae850f0f4d3b63ca0cba7ac2b2a34
This commit is contained in:
Stephen Finucane 2022-09-06 10:58:34 +01:00
parent 2921e723b6
commit 6b7bc9f37b

View File

@ -60,7 +60,7 @@ CONF.register_opts(test_opts)
_DB_CACHE = None _DB_CACHE = None
class Database(fixtures.Fixture): class DatabaseFixture(fixtures.Fixture):
def __init__(self, db_session, db_migrate, sql_connection, sqlite_db, def __init__(self, db_session, db_migrate, sql_connection, sqlite_db,
sqlite_clean_db): sqlite_clean_db):
@ -86,7 +86,7 @@ class Database(fixtures.Fixture):
shutil.copyfile(testdb, cleandb) shutil.copyfile(testdb, cleandb)
def setUp(self): def setUp(self):
super(Database, self).setUp() super().setUp()
if self.sql_connection == "sqlite://": if self.sql_connection == "sqlite://":
conn = self.engine.connect() conn = self.engine.connect()
conn.connection.executescript(self._DB) conn.connection.executescript(self._DB)
@ -116,7 +116,7 @@ class TestCase(base_test.BaseTestCase):
global _DB_CACHE global _DB_CACHE
if not _DB_CACHE: if not _DB_CACHE:
_DB_CACHE = Database( _DB_CACHE = DatabaseFixture(
db_api, db_api,
migration, migration,
sql_connection=CONF.database.connection, sql_connection=CONF.database.connection,