コード例 #1
0
 def test_interval_None(self):
     """Test generator with interval=None"""
     gen = heartbeat_generator(None, out=self.stdout, time=self.timer)
     gen.next()
     self.assertFalse(self.stdout.buflist)
     self.timer.advance(5)
     gen.next()
     self.assertFalse(self.stdout.buflist)
     self.timer.advance(5)
コード例 #2
0
 def test_interval_None(self):
     """Test generator with interval=None"""
     gen = heartbeat_generator(None, out=self.stdout, time=self.timer)
     gen.next()
     self.assertFalse(self.stdout.buflist)
     self.timer.advance(5)
     gen.next()
     self.assertFalse(self.stdout.buflist)
     self.timer.advance(5)
コード例 #3
0
 def test_send_heartbeat_on_interval(self):
     """Test that we actually send the heartbeat."""
     gen = heartbeat_generator(2, out=self.stdout, time=self.timer)
     gen.next()
     self.assertFalse(self.stdout.buflist)
     self.timer.advance(2)
     gen.next()
     output = self.stdout.buflist
     self.assertTrue('<!--XSUPERVISOR:BEGIN-->' in output)
     self.assertTrue('<!--XSUPERVISOR:END-->' in output)
コード例 #4
0
 def test_send_heartbeat_on_interval(self):
     """Test that we actually send the heartbeat."""
     gen = heartbeat_generator(2, out=self.stdout, time=self.timer)
     gen.next()
     self.assertFalse(self.stdout.buflist)
     self.timer.advance(2)
     gen.next()
     output = self.stdout.buflist
     self.assertTrue('<!--XSUPERVISOR:BEGIN-->' in output)
     self.assertTrue('<!--XSUPERVISOR:END-->' in output)
コード例 #5
0
 def test_not_send_heartbeat(self):
     """Test that we don't send the heartbeat."""
     gen = heartbeat_generator(2, out=self.stdout, time=self.timer)
     gen.next()
     self.assertFalse(self.stdout.buflist)
     self.timer.advance(0.5)
     gen.next()
     self.assertFalse(self.stdout.buflist)
     self.timer.advance(0.5)
     gen.next()
     self.assertFalse(self.stdout.buflist)
コード例 #6
0
 def test_not_send_heartbeat(self):
     """Test that we don't send the heartbeat."""
     gen = heartbeat_generator(2, out=self.stdout, time=self.timer)
     gen.next()
     self.assertFalse(self.stdout.buflist)
     self.timer.advance(0.5)
     gen.next()
     self.assertFalse(self.stdout.buflist)
     self.timer.advance(0.5)
     gen.next()
     self.assertFalse(self.stdout.buflist)