aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjcass <john.cass77@gmail.com>2016-01-12 18:08:08 +0200
committerjcass <john.cass77@gmail.com>2016-01-12 18:08:08 +0200
commit296c91c836ad41a5130711bcd6f30117a4c48265 (patch)
tree78300d0b5c4f444e6a5fbad8dca1d6a191f83450
parent4349a4a92f2c0581531b10fd39b6a938ef465d57 (diff)
downloadpydora-296c91c836ad41a5130711bcd6f30117a4c48265.tar.bz2
pydora-296c91c836ad41a5130711bcd6f30117a4c48265.tar.xz
pydora-296c91c836ad41a5130711bcd6f30117a4c48265.zip
Remove unreachable code. Test case for avoiding retries on PandoraException being raised.
-rw-r--r--pandora/transport.py2
-rw-r--r--tests/test_pandora/test_transport.py14
2 files changed, 14 insertions, 2 deletions
diff --git a/pandora/transport.py b/pandora/transport.py
index 5681aec..bba1608 100644
--- a/pandora/transport.py
+++ b/pandora/transport.py
@@ -56,8 +56,6 @@ def retries(max_tries, exceptions=(Exception,)):
56 0.5, 2, max_tries - retries_left)) 56 0.5, 2, max_tries - retries_left))
57 else: 57 else:
58 raise 58 raise
59 else:
60 break
61 59
62 return function 60 return function
63 61
diff --git a/tests/test_pandora/test_transport.py b/tests/test_pandora/test_transport.py
index 6596a0e..394916b 100644
--- a/tests/test_pandora/test_transport.py
+++ b/tests/test_pandora/test_transport.py
@@ -1,5 +1,6 @@
1import time 1import time
2from unittest import TestCase 2from unittest import TestCase
3from pandora.errors import PandoraException
3 4
4from pandora.py2compat import Mock, call 5from pandora.py2compat import Mock, call
5 6
@@ -25,3 +26,16 @@ class TestTransport(TestCase):
25 26
26 client.transport._start_request.assert_has_calls([call("method")]) 27 client.transport._start_request.assert_has_calls([call("method")])
27 assert client.transport._start_request.call_count == 5 28 assert client.transport._start_request.call_count == 5
29
30 def test_call_should_not_retry_for_pandora_exceptions(self):
31 client = TestSettingsDictBuilder._build_minimal()
32
33 time.sleep = Mock()
34 client.transport._make_http_request = Mock(
35 side_effect=PandoraException("error_mock"))
36 client.transport._start_request = Mock()
37
38 client("method")
39
40 client.transport._start_request.assert_has_calls([call("method")])
41 assert client.transport._start_request.call_count == 1