Updated openstack/openstack
Project: openstack/ceilometer  09720bf5248b3802cb5e08c7051669fda55984c3

Avoid reading real config files in unit test

When we call oslo.config.cfg.CONF(), it will do basic setup and
search configuration files under certain directories, by default,
they are [/etc, /etc/ceilometer, ~/, ~/.ceilometer]. However, we
should avoid such behaviour when we run unit test code, because that
if the system has run devstack or installed ceilometer services,
then /etc/ceilometer/ceilometer.conf will exist, then unit test result
can be different.

So we should mock the default searching directories of cfg in the
begining of all unit tests, which will call cfg.CONF() at somewhere
during the test. The best place to mock the default directories
can be ceilometer.test.base.BaseTestCase, which should be used as
parent class of all other test classes.

Note: since this patch sets default searching directory to
{repo}/etc/ceilometer, you can run the unit test with different settings
which are set in etc/ceilometer/ceilometer.conf (not tracked by git).

Note: mock.patch.stopall has compatibility problem with oslo.fixture,
so this patch slightly refactors the
tests.compute.pollsters.base.TestPollsterBase.setUp method.

Change-Id: I533ffb2ba2c9be0223cecbcf04176312e4a96369
Closes-Bug: #1328550