From 251264b1b6781d0560988401e4c8095a5cb6f64a Mon Sep 17 00:00:00 2001 From: Matt Riedemann Date: Tue, 11 Jun 2019 20:18:20 -0400 Subject: [PATCH] Cleanup ConfFixture This makes the ConfFixture extend the Config fixture from oslo.config which handles cleanup for us. The module level import_opt calls are also removed since they are no longer needed. Change-Id: I869e89c53284c8da45e0b1293f2d35011f5bfbf9 --- watcher/tests/conf_fixture.py | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/watcher/tests/conf_fixture.py b/watcher/tests/conf_fixture.py index 3e197b9f0..952617cd9 100644 --- a/watcher/tests/conf_fixture.py +++ b/watcher/tests/conf_fixture.py @@ -14,30 +14,21 @@ # License for the specific language governing permissions and limitations # under the License. -import fixtures from oslo_config import cfg +from oslo_config import fixture as conf_fixture from watcher.common import config -CONF = cfg.CONF -CONF.import_opt('host', 'watcher.conf.service') -CONF.import_opt('connection', 'oslo_db.options', group='database') -CONF.import_opt('sqlite_synchronous', 'oslo_db.options', group='database') - -class ConfFixture(fixtures.Fixture): +class ConfFixture(conf_fixture.Config): """Fixture to manage conf settings.""" - def __init__(self, conf=cfg.CONF): - self.conf = conf - def setUp(self): super(ConfFixture, self).setUp() self.conf.set_default('connection', "sqlite://", group='database') self.conf.set_default('sqlite_synchronous', False, group='database') config.parse_args([], default_config_files=[]) - self.addCleanup(self.conf.reset) class ConfReloadFixture(ConfFixture):