KVM test: tests_base.cfg. sample: Fix test dependencies
[autotest-zwu.git] / scheduler / gc_stats_unittest.py
blobddb5065e1d85919363aed3598e9120d013919f4d
1 #!/usr/bin/python
3 import gc
4 import logging
6 import common
7 from autotest_lib.client.common_lib.test_utils import mock
8 from autotest_lib.client.common_lib.test_utils import unittest
9 from autotest_lib.scheduler import gc_stats
12 class TestGcStats(unittest.TestCase):
13 def setUp(self):
14 self.god = mock.mock_god()
17 def tearDown(self):
18 self.god.unstub_all()
21 def test_log_garbage_collector_stats(self):
22 # Call this for code coverage.
23 # Prevent log spam from this test but do test that the log
24 # message formats correctly.
25 def _mock_logging_func(message, *args):
26 if args:
27 message %= args
28 self.god.stub_with(logging, 'debug', _mock_logging_func)
29 self.god.stub_with(logging, 'info', _mock_logging_func)
30 gc_stats._log_garbage_collector_stats()
31 # Add a new dict, exercise the delta counting & printing code.
32 y = {}
33 gc_stats._log_garbage_collector_stats(1)
36 if __name__ == '__main__':
37 unittest.main()