Esempio n. 1
0
 def init_stats_history(self):
     """Init the stats history (dict of GlancesAttribute)."""
     if self._history_enable():
         init_list = [a['name'] for a in self.get_items_history_list()]
         logger.debug(
             "Stats history activated for plugin {} (items: {})".format(
                 self.plugin_name, init_list))
     return GlancesHistory()
Esempio n. 2
0
 def test_098_history(self):
     """Test GlancesHistory classe"""
     print('INFO: [TEST_098] Test history')
     # GlancesHistory
     from glances.history import GlancesHistory
     h = GlancesHistory()
     h.add('a', 1)
     h.add('a', 2)
     h.add('a', 3)
     h.add('b', 10)
     h.add('b', 20)
     h.add('b', 30)
     self.assertEqual(len(h.get()), 2)
     self.assertEqual(len(h.get()['a']), 3)
     h.reset()
     self.assertEqual(len(h.get()), 2)
     self.assertEqual(len(h.get()['a']), 0)
Esempio n. 3
0
 def test_098_history(self):
     """Test GlancesHistory classe"""
     print('INFO: [TEST_098] Test history')
     # GlancesHistory
     from glances.history import GlancesHistory
     h = GlancesHistory()
     h.add('a', 1)
     h.add('a', 2)
     h.add('a', 3)
     h.add('b', 10)
     h.add('b', 20)
     h.add('b', 30)
     self.assertEqual(len(h.get()), 2)
     self.assertEqual(len(h.get()['a']), 3)
     h.reset()
     self.assertEqual(len(h.get()), 2)
     self.assertEqual(len(h.get()['a']), 0)