Test Max Retries
See original GitHub issueI made an HTTP adapter:
session = requests.Session()
session.verify = False
# Try max of 3 times before erroring out
retry_adapter = requests.adapters.HTTPAdapter(max_retries=3)
session.mount('https://', retry_adapter)
I wanted to make sure it will automatically retry, but it seems it’s not getting triggered right:
exception = ConnectionError('Bad connection')
with responses.RequestsMock(assert_all_requests_are_fired=False) as rsp:
rsp.add(responses.POST, url, body=exception)
rsp.add(responses.POST, url, body=exception)
rsp.add(responses.POST, url, body='{}')
session.post(url=url, json={})
It just keeps raising the exception.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:28
- Comments:26 (6 by maintainers)
Top Results From Across the Web
Test Retries | Cypress Documentation
With test retries, Cypress is able to retry failed tests to help reduce test flakiness and continuous integration (CI) build failures.
Read more >Retry Flaky Tests - WebdriverIO
You can rerun certain tests with the WebdriverIO testrunner that turn out to be unstable due to things like a flaky network or...
Read more >Retrying Failing Tests - JUnit Pioneer
The JUnit 5 (Jupiter) extension @RetryingTest retries a failing test a certain number of times; only marking the test failed if no execution...
Read more >"Max retries exceeded" error when running real device test ...
The Python bindings use urllib3 to create HTTP connections and by default urllib3 has a 3 retry limit. Sauce Labs sends a 303...
Read more >Retry - NUnit Docs
RetryAttribute is used on a test method to specify that it should be rerun if it fails, up to a maximum number of...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Same here, trying to test a session with
Retry
.+1
Retry don’t work with responses lib, so I think at least it would be nice to write about such limitation in readme or docs.