summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRay Holder <ray.holder+github@gmail.com>2014-05-05 19:11:28 +0200
committerRay Holder <ray.holder+github@gmail.com>2014-05-05 19:11:28 +0200
commit036672e4b18ded2b9b0d13a9aa58991a09ff2f53 (patch)
treecdfd3866cdf52234815076c5300edf79cb852077
parentc86e061eaa65b960ce6c56439a05d9f1c9d55717 (diff)
parentff817d98fc98b722befb3bbb1a6a53cc3f207a5d (diff)
downloadretrying-036672e4b18ded2b9b0d13a9aa58991a09ff2f53.tar.gz
Merge pull request #5 from alexkuang/master
Fix AttributeError when explicitly specifying wait type ...
-rw-r--r--AUTHORS.rst1
-rw-r--r--retrying.py2
-rw-r--r--test_retrying.py6
3 files changed, 8 insertions, 1 deletions
diff --git a/AUTHORS.rst b/AUTHORS.rst
index ec69c5d..8c1aa55 100644
--- a/AUTHORS.rst
+++ b/AUTHORS.rst
@@ -14,3 +14,4 @@ Patches and Suggestions
- Jason Dunkelberger
- Justin Turner Arthur
- J Derek Wilson
+- Alex Kuang
diff --git a/retrying.py b/retrying.py
index d705d14..b337744 100644
--- a/retrying.py
+++ b/retrying.py
@@ -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:
diff --git a/test_retrying.py b/test_retrying.py
index b5f7ed6..43c9000 100644
--- a/test_retrying.py
+++ b/test_retrying.py
@@ -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.