summaryrefslogtreecommitdiff
path: root/oslo_db
diff options
context:
space:
mode:
authorStephen Finucane <stephenfin@redhat.com>2021-07-16 12:37:24 +0100
committerStephen Finucane <stephenfin@redhat.com>2021-07-29 16:36:38 +0100
commit538e0a23abd8dfb7a2fe4a47655e759a50138b13 (patch)
treea0323e610b203dad61d1eca6420a2e661ac99415 /oslo_db
parent73e376d2fd5c96a9a3ddd1aea43197f82dd767c2 (diff)
downloadoslo-db-538e0a23abd8dfb7a2fe4a47655e759a50138b13.tar.gz
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>
Diffstat (limited to 'oslo_db')
-rw-r--r--oslo_db/tests/sqlalchemy/test_options.py6
-rw-r--r--oslo_db/tests/test_concurrency.py5
-rw-r--r--oslo_db/tests/utils.py7
3 files changed, 9 insertions, 9 deletions
diff --git a/oslo_db/tests/sqlalchemy/test_options.py b/oslo_db/tests/sqlalchemy/test_options.py
index a0cb5d4..93aaf5b 100644
--- a/oslo_db/tests/sqlalchemy/test_options.py
+++ b/oslo_db/tests/sqlalchemy/test_options.py
@@ -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]
diff --git a/oslo_db/tests/test_concurrency.py b/oslo_db/tests/test_concurrency.py
index 91e2f64..6e1cd4b 100644
--- a/oslo_db/tests/test_concurrency.py
+++ b/oslo_db/tests/test_concurrency.py
@@ -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)
diff --git a/oslo_db/tests/utils.py b/oslo_db/tests/utils.py
index c7e1e1f..853f983 100644
--- a/oslo_db/tests/utils.py
+++ b/oslo_db/tests/utils.py
@@ -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