Unit tests: Remove deprecated oslo_db test case classes

Migrate to the new, modern, fixtures-based test framework in oslo_db. This
eliminates about 35 deprecation messages when running the unit tests.

Change-Id: I502c8f9e0718558ae93ff5a568c1ef9ee17ca7f7
This commit is contained in:
Zane Bitter 2017-10-19 17:44:33 -04:00
parent 23c62e30fb
commit 2382f46d4e
1 changed files with 32 additions and 24 deletions

View File

@ -26,11 +26,13 @@ import os
import uuid
from migrate.versioning import repository
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 test_migrations
from oslo_db.sqlalchemy import utils
from oslo_serialization import jsonutils
from oslo_utils import timeutils
from oslotest import base as test_base
import six
import sqlalchemy
import testtools
@ -738,18 +740,24 @@ class HeatMigrationsCheckers(test_migrations.WalkVersionsMixin,
'attr_data_id')
class TestHeatMigrationsMySQL(HeatMigrationsCheckers,
test_base.MySQLOpportunisticTestCase):
pass
class DbTestCase(test_fixtures.OpportunisticDBTestMixin,
test_base.BaseTestCase):
def setUp(self):
super(DbTestCase, self).setUp()
self.engine = enginefacade.writer.get_engine()
self.sessionmaker = enginefacade.writer.get_sessionmaker()
class TestHeatMigrationsPostgreSQL(HeatMigrationsCheckers,
test_base.PostgreSQLOpportunisticTestCase):
pass
class TestHeatMigrationsMySQL(DbTestCase, HeatMigrationsCheckers):
FIXTURE = test_fixtures.MySQLOpportunisticFixture
class TestHeatMigrationsSQLite(HeatMigrationsCheckers,
test_base.DbTestCase):
class TestHeatMigrationsPostgreSQL(DbTestCase, HeatMigrationsCheckers):
FIXTURE = test_fixtures.PostgresqlOpportunisticFixture
class TestHeatMigrationsSQLite(DbTestCase, HeatMigrationsCheckers):
pass
@ -770,19 +778,19 @@ class ModelsMigrationSyncMixin(object):
return True
class ModelsMigrationsSyncMysql(ModelsMigrationSyncMixin,
test_migrations.ModelsMigrationsSync,
test_base.MySQLOpportunisticTestCase):
pass
class ModelsMigrationsSyncPostgres(ModelsMigrationSyncMixin,
test_migrations.ModelsMigrationsSync,
test_base.PostgreSQLOpportunisticTestCase):
pass
class ModelsMigrationsSyncSQLite(ModelsMigrationSyncMixin,
test_migrations.ModelsMigrationsSync,
test_base.DbTestCase):
class ModelsMigrationsSyncMysql(DbTestCase,
ModelsMigrationSyncMixin,
test_migrations.ModelsMigrationsSync):
FIXTURE = test_fixtures.MySQLOpportunisticFixture
class ModelsMigrationsSyncPostgres(DbTestCase,
ModelsMigrationSyncMixin,
test_migrations.ModelsMigrationsSync):
FIXTURE = test_fixtures.PostgresqlOpportunisticFixture
class ModelsMigrationsSyncSQLite(DbTestCase,
ModelsMigrationSyncMixin,
test_migrations.ModelsMigrationsSync):
pass