Always init cfg.CONF before running a test
In all tests cfg.CONF is not (re)initialised correctly By chance in ceilometer , the only method that fail when conf is not initialised is cfg.CONF.find_file. And because some tests do special initialisation (ie: the ones that test ceilometer.service.prepare_service stuff), the method cfg.CONF.find_file works when we run all tests. But if you decide to run only one test (like below) that use find_file it fail because cfg.CONF is not initialised. tox -epy27,pep8 api.v2 Not all configurations opts are impacted but only the CLI opts ones that are set only when cfg.CONF() is called. This change initialise cfg.CONF on each test (but the test can continue to reinitialise it if needed) Change-Id: I37842e945a7e2908e17d5ce886e17047a36818f7
This commit is contained in:
parent
33b691fa57
commit
3ee1fa3f13
@ -36,6 +36,7 @@ class TestCase(testtools.TestCase):
|
||||
self.stubs = stubout.StubOutForTesting()
|
||||
self.tempdir = self.useFixture(fixtures.TempDir())
|
||||
self.useFixture(fixtures.FakeLogger())
|
||||
cfg.CONF([], project='ceilometer')
|
||||
|
||||
# Set a default location for the pipeline config file so the
|
||||
# tests work even if ceilometer is not installed globally on
|
||||
|
Loading…
x
Reference in New Issue
Block a user