Example #1
0
 def test_stop_func(self):
     r = Retrying(stop=lambda attempt, delay: attempt == delay)
     self.assertFalse(r.stop(1, 3))
     self.assertFalse(r.stop(100, 99))
     self.assertTrue(r.stop(101, 101))
Example #2
0
 def test_stop_after_attempt(self):
     r = Retrying(stop=tenacity.stop_after_attempt(3))
     self.assertFalse(r.stop(2, 6546))
     self.assertTrue(r.stop(3, 6546))
     self.assertTrue(r.stop(4, 6546))
Example #3
0
 def test_stop_after_delay(self):
     r = Retrying(stop=tenacity.stop_after_delay(1))
     self.assertFalse(r.stop(2, 0.999))
     self.assertTrue(r.stop(2, 1))
     self.assertTrue(r.stop(2, 1.001))
Example #4
0
 def test_never_stop(self):
     r = Retrying()
     self.assertFalse(r.stop(3, 6546))