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