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
This commit is contained in:
Matt Riedemann
2019-06-11 20:18:20 -04:00
parent 46a36d1ad7
commit 251264b1b6

View File

@@ -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):