blob: 9d01e8dc001e78f8bde35a8cde508d4df356724e [file] [log] [blame]
showardf13a9e22009-12-18 22:54:09 +00001#!/usr/bin/python
2
3import gc
4import logging
Justin Giorgi67ad67d2016-06-29 14:41:04 -07005import unittest
showardf13a9e22009-12-18 22:54:09 +00006
7import common
8from autotest_lib.client.common_lib.test_utils import mock
showardf13a9e22009-12-18 22:54:09 +00009from autotest_lib.scheduler import gc_stats
10
11
12class TestGcStats(unittest.TestCase):
13 def setUp(self):
14 self.god = mock.mock_god()
15
16
17 def tearDown(self):
18 self.god.unstub_all()
19
20
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)
34
35
36if __name__ == '__main__':
37 unittest.main()