aodh/ceilometer/tests/compute/pollsters
ZhiQiang Fan 59e647f82c 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
2014-06-18 12:17:23 +08:00
..
__init__.py Move tests into ceilometer module 2013-11-13 15:32:31 +01:00
base.py Avoid reading real config files in unit test 2014-06-18 12:17:23 +08:00
test_cpu.py Remove (c) and remove unnecessary encoding lines 2014-05-31 13:02:21 +02:00
test_diskio.py Remove (c) and remove unnecessary encoding lines 2014-05-31 13:02:21 +02:00
test_instance.py Remove (c) and remove unnecessary encoding lines 2014-05-31 13:02:21 +02:00
test_location_metadata.py Remove (c) and remove unnecessary encoding lines 2014-05-31 13:02:21 +02:00
test_memory.py VMware vSphere: Improve the accuracy of queried samples 2014-03-25 19:46:19 +05:30
test_net.py Remove (c) and remove unnecessary encoding lines 2014-05-31 13:02:21 +02:00