Merge pull request #5 from alexkuang/master

Fix AttributeError when explicitly specifying wait type ...
This commit is contained in:
Ray Holder 2014-05-05 19:11:28 +02:00
commit 036672e4b1
3 changed files with 8 additions and 1 deletions

View File

@ -14,3 +14,4 @@ Patches and Suggestions
- Jason Dunkelberger
- Justin Turner Arthur
- J Derek Wilson
- Alex Kuang

View File

@ -151,7 +151,7 @@ class Retrying(object):
self.wait = lambda attempts, delay: max(f(attempts, delay) for f in wait_funcs)
else:
self.wait = self.getattr(wait)
self.wait = getattr(self, wait)
# retry on exception filter
if retry_on_exception is None:

View File

@ -37,6 +37,9 @@ class TestStopConditions(unittest.TestCase):
self.assertTrue(r.stop(2, 1000))
self.assertTrue(r.stop(2, 1001))
def test_legacy_explicit_stop_type(self):
r = Retrying(stop="stop_after_attempt")
class TestWaitConditions(unittest.TestCase):
def test_no_sleep(self):
@ -108,6 +111,9 @@ class TestWaitConditions(unittest.TestCase):
self.assertEqual(r.wait(7, 0), 50000)
self.assertEqual(r.wait(50, 0), 50000)
def test_legacy_explicit_wait_type(self):
r = Retrying(wait="exponential_sleep")
class NoneReturnUntilAfterCount:
"""
This class holds counter state for invoking a method several times in a row.