From 9496c6517b4378b16c9c041080eb9e252ff9dc28 Mon Sep 17 00:00:00 2001 From: Johannes Erdfelt Date: Wed, 26 Nov 2014 09:16:12 -0800 Subject: [PATCH] Fix use of conf_fixture As the name implies, conf_fixture.ConfFixture is a fixture. It should be used by calling self.useFixture() instead of calling it directly. This ensures that the setUp() method is called correctly. If the test classes are executed individually, the database config options are not registered correctly and could result in this failure for each test case: NoSuchOptError: no such option in group database: backend Closes-bug: 1396703 Change-Id: Iaf7e1aedaacf24508e55f4d6975946f83ef833a6 --- nova/tests/unit/db/test_migrations.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/nova/tests/unit/db/test_migrations.py b/nova/tests/unit/db/test_migrations.py index b5985a7e97..a2cfd9fa7c 100644 --- a/nova/tests/unit/db/test_migrations.py +++ b/nova/tests/unit/db/test_migrations.py @@ -84,8 +84,7 @@ class NovaMigrationsCheckers(test_migrations.WalkVersionsMixin): def setUp(self): super(NovaMigrationsCheckers, self).setUp() - conf_fixture.ConfFixture(cfg.CONF) - self.addCleanup(cfg.CONF.reset) + self.useFixture(conf_fixture.ConfFixture(cfg.CONF)) # NOTE(viktors): We should reduce log output because it causes issues, # when we run tests with testr migrate_log = logging.getLogger('migrate')