summaryrefslogtreecommitdiff
path: root/t/unit/utils
diff options
context:
space:
mode:
authorEric Higdon <EricHigdon@users.noreply.github.com>2019-08-13 13:51:40 -0400
committerAsif Saif Uddin <auvipy@gmail.com>2019-08-13 23:51:40 +0600
commit5f93e868cfc6501f01ddbc4f331d8a9fef4e7790 (patch)
treed98b2c074de4666fdfc4d41476893a2501d37ffc /t/unit/utils
parent0ad7d08c4cb4abce32e9d765d0bb16b92830451f (diff)
downloadkombu-5f93e868cfc6501f01ddbc4f331d8a9fef4e7790.tar.gz
Make sure that max_retries=0 is treated differently than None (#1080)
* Make sure that max_retries=0 is treated differently than None When max_retries=0, it should not retry at all instead of retrying infinitely. * retry_always should use max_retries=None instead of 0. * Added test for zero retries * Removed Offending spaces from blank line
Diffstat (limited to 't/unit/utils')
-rw-r--r--t/unit/utils/test_functional.py17
1 files changed, 16 insertions, 1 deletions
diff --git a/t/unit/utils/test_functional.py b/t/unit/utils/test_functional.py
index c8b4485e..2ed64761 100644
--- a/t/unit/utils/test_functional.py
+++ b/t/unit/utils/test_functional.py
@@ -227,6 +227,21 @@ class test_retry_over_time:
)
@mock.sleepdeprived(module=utils)
+ def test_retry_zero(self):
+ with pytest.raises(self.Predicate):
+ retry_over_time(
+ self.myfun, self.Predicate,
+ max_retries=0, errback=self.errback, interval_max=14,
+ )
+ assert self.index == 0
+ # no errback
+ with pytest.raises(self.Predicate):
+ retry_over_time(
+ self.myfun, self.Predicate,
+ max_retries=0, errback=None, interval_max=14,
+ )
+
+ @mock.sleepdeprived(module=utils)
def test_retry_once(self):
with pytest.raises(self.Predicate):
retry_over_time(
@@ -261,7 +276,7 @@ class test_retry_over_time:
assert retry_over_time(
fun, self.Predicate,
- max_retries=0, errback=None, interval_max=14) == 42
+ max_retries=None, errback=None, interval_max=14) == 42
assert fun.calls == 11