tests: Enfeeble 'oslo_db.tests.utils.BaseTestCase'

We have quite a few base test classes in use. Start fixing these by
removing the logic from one of these. We will remove the class entirely
in a future change.

Change-Id: I6dae26aeb4b2a5cc4f39ed637807a27e44d40025
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
This commit is contained in:
Stephen Finucane 2021-07-16 12:37:24 +01:00
parent 73e376d2fd
commit 538e0a23ab
3 changed files with 9 additions and 9 deletions

View File

@ -12,7 +12,7 @@
# under the License.
from oslo_config import cfg
from oslo_config import fixture as config
from oslo_config import fixture as config_fixture
from oslo_db import options
from oslo_db.tests import utils as test_utils
@ -22,10 +22,8 @@ class DbApiOptionsTestCase(test_utils.BaseTestCase):
def setUp(self):
super(DbApiOptionsTestCase, self).setUp()
config_fixture = self.useFixture(config.Config())
self.conf = config_fixture.conf
self.conf = self.useFixture(config_fixture.Config()).conf
self.conf.register_opts(options.database_opts, group='database')
self.config = config_fixture.config
def test_deprecated_session_parameters(self):
path = self.create_tempfiles([["tmp", b"""[DEFAULT]

View File

@ -16,6 +16,8 @@
import sys
from unittest import mock
from oslo_config import fixture as config_fixture
from oslo_db import concurrency
from oslo_db.tests import utils as test_utils
@ -26,6 +28,9 @@ class TpoolDbapiWrapperTestCase(test_utils.BaseTestCase):
def setUp(self):
super(TpoolDbapiWrapperTestCase, self).setUp()
self.conf = self.useFixture(config_fixture.Config()).conf
self.db_api = concurrency.TpoolDbapiWrapper(
conf=self.conf, backend_mapping=FAKE_BACKEND_MAPPING)

View File

@ -15,7 +15,6 @@
import contextlib
from oslo_config import cfg
from oslotest import base as test_base
@ -25,8 +24,6 @@ def nested(*contexts):
yield [stack.enter_context(c) for c in contexts]
# TODO(stephenfin): Remove as this is no longer necessary
class BaseTestCase(test_base.BaseTestCase):
def setUp(self, conf=cfg.CONF):
super(BaseTestCase, self).setUp()
self.conf = conf
self.addCleanup(self.conf.reset)
pass