diff --git a/glance/tests/unit/common/test_swift_store_utils.py b/glance/tests/unit/common/test_swift_store_utils.py index f5f439d85e..199fe609a3 100644 --- a/glance/tests/unit/common/test_swift_store_utils.py +++ b/glance/tests/unit/common/test_swift_store_utils.py @@ -22,11 +22,11 @@ from glance.tests.unit import base class TestSwiftParams(base.IsolatedUnitTest): def setUp(self): + super(TestSwiftParams, self).setUp() conf_file = "glance-swift.conf" test_dir = self.useFixture(fixtures.TempDir()).path self.swift_config_file = self._copy_data_file(conf_file, test_dir) self.config(swift_store_config_file=self.swift_config_file) - super(TestSwiftParams, self).setUp() def tearDown(self): super(TestSwiftParams, self).tearDown() diff --git a/glance/tests/utils.py b/glance/tests/utils.py index 853e2407b4..0f1b97a13f 100644 --- a/glance/tests/utils.py +++ b/glance/tests/utils.py @@ -25,6 +25,7 @@ import subprocess import fixtures from oslo_config import cfg +from oslo_config import fixture as cfg_fixture from oslo_log import log from oslo_serialization import jsonutils from oslo_utils import timeutils @@ -64,6 +65,8 @@ class BaseTestCase(testtools.TestCase): def setUp(self): super(BaseTestCase, self).setUp() + self._config_fixture = self.useFixture(cfg_fixture.Config()) + # NOTE(bcwaldon): parse_args has to be called to register certain # command-line options - specifically we need config_dir for # the following policy tests @@ -122,9 +125,7 @@ class BaseTestCase(testtools.TestCase): All overrides are automatically cleared at the end of the current test by the fixtures cleanup process. """ - group = kw.pop('group', None) - for k, v in six.iteritems(kw): - CONF.set_override(k, v, group) + self._config_fixture.config(**kw) class requires(object):