Skip to content

Commit

Permalink
[azure-core] Fixes 'no retries' config in retry policy (#5803)
Browse files Browse the repository at this point in the history
* fixes no retries config

* adds a no retries test
  • Loading branch information
kristapratico authored Jun 12, 2019
1 parent 55c8295 commit 88eb9bb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion sdk/core/azure-core/azure/core/pipeline/policies/retry.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def __init__(self, **kwargs):
def no_retries(cls):
"""Disable retries.
"""
return cls(retry_count_total=0)
return cls(retry_total=0)

def configure_retries(self, options):
"""Configures the retry settings.
Expand Down
14 changes: 14 additions & 0 deletions sdk/core/azure-core/examples/examples_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,3 +151,17 @@ def test_example_retry_policy():

response = pipeline_response.http_response
assert response.status_code == 200

def test_example_no_retries():
url = "https://bing.com"

config = Configuration()
config.retry_policy = RetryPolicy.no_retries()

client = PipelineClient(base_url=url, config=config)
request = client.get(url)
pipeline_response = client._pipeline.run(request)

response = pipeline_response.http_response
# bing returns 301 if not retried
assert response.status_code == 301

0 comments on commit 88eb9bb

Please sign in to comment.