tests: Remove use of 'oslo_db.sqlalchemy.test_base'

It has been reported that "the various test cases and mixins
in 'oslo_db.sqlalchemy.test_base' have been deprecated since
oslo.db 4.34.0 (March 2018)." so migrate to a more stable
and supported solution.

Change-Id: I89aff35352406c0895d379ef6548b406572d076d
This commit is contained in:
Luigi Toscano 2022-04-14 23:20:36 +02:00 committed by Stephen Finucane
parent f3fea3abb7
commit 2627d3433b
1 changed files with 13 additions and 5 deletions

View File

@ -31,14 +31,20 @@ postgres=# create database openstack_citest with owner openstack_citest;
import os
from oslo_db.sqlalchemy import test_base
from oslo_db.sqlalchemy import enginefacade
from oslo_db.sqlalchemy import test_fixtures
from oslo_db.sqlalchemy import utils as db_utils
from oslotest import base as test_base
from sahara.tests.unit.db.migration import test_migrations_base as base
class SaharaMigrationsCheckers(object):
def setUp(self):
super().setUp()
self.engine = enginefacade.writer.get_engine()
def assertColumnExists(self, engine, table, column):
t = db_utils.get_table(engine, table)
self.assertIn(column, t.c)
@ -646,12 +652,14 @@ class SaharaMigrationsCheckers(object):
class TestMigrationsMySQL(SaharaMigrationsCheckers,
base.BaseWalkMigrationTestCase,
base.TestModelsMigrationsSync,
test_base.MySQLOpportunisticTestCase):
pass
test_fixtures.OpportunisticDBTestMixin,
test_base.BaseTestCase):
FIXTURE = test_fixtures.MySQLOpportunisticFixture
class TestMigrationsPostgresql(SaharaMigrationsCheckers,
base.BaseWalkMigrationTestCase,
base.TestModelsMigrationsSync,
test_base.PostgreSQLOpportunisticTestCase):
pass
test_fixtures.OpportunisticDBTestMixin,
test_base.BaseTestCase):
FIXTURE = test_fixtures.PostgresqlOpportunisticFixture