Ejemplo n.º 1
0
 def test_timeout(self):
     throttledlog.throttle('test', 10, timeout=7)
     for i in range(12):
         throttledlog.debug('test', "Cycle: %s", i)
         throttledlog.monotonic_time.time += 1.0
     self.assertEqual(throttledlog._logger.messages,
                      ['Cycle: %s' % (i,) for i in (0, 7, 10,)])
Ejemplo n.º 2
0
 def test_timeout(self):
     throttledlog.throttle('test', 10, timeout=7)
     for i in range(12):
         throttledlog.debug('test', "Cycle: %s", i)
         throttledlog.monotonic_time.time += 1.0
     self.assertEqual(throttledlog._logger.messages,
                      ['Cycle: %s' % (i,) for i in (0, 7, 10,)])
Ejemplo n.º 3
0
 def test_default(self):
     throttledlog.throttle('test', 3)
     for i in range(5):
         throttledlog.debug('other', "Cycle: %s", i)
     self.assertEqual(throttledlog._logger.messages,
                      ['Cycle: %s' % (i, ) for i in range(5)])
Ejemplo n.º 4
0
 def test_no_logging(self):
     throttledlog.throttle('test', 3)
     for i in range(5):
         throttledlog.debug('test', "Cycle: %s", i)
     self.assertEqual(throttledlog._logger.messages, [])
Ejemplo n.º 5
0
 def test_default(self):
     throttledlog.throttle("test", 3)
     for i in range(5):
         throttledlog.debug("other", "Cycle: %s", i)
     self.assertEqual(throttledlog._logger.messages, ["Cycle: %s" % (i,) for i in range(5)])
Ejemplo n.º 6
0
 def test_no_logging(self):
     throttledlog.throttle("test", 3)
     for i in range(5):
         throttledlog.debug("test", "Cycle: %s", i)
     self.assertEqual(throttledlog._logger.messages, [])
Ejemplo n.º 7
0
 def test_default(self):
     throttledlog.throttle('test', 3)
     for i in range(5):
         throttledlog.debug('other', "Cycle: %s", i)
     self.assertEqual(throttledlog._logger.messages,
                      ['Cycle: %s' % (i,) for i in range(5)])
Ejemplo n.º 8
0
 def test_throttled_logging(self):
     throttledlog.throttle('test', 3)
     for i in range(5):
         throttledlog.debug('test', "Cycle: %s", i)
     self.assertEqual(throttledlog._logger.messages,
                      ['Cycle: 0', 'Cycle: 3'])