You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to work on the retry branch again. To test things I'd like to make a request that fails once or twice and then finally succeeds. However, each of the methods in dummyserver/handlers.py is idempotent, which makes this a little bit tricky.
I'm considering the following:
Adding a method to handlers.py that tracks state on the class, or resets a class property ("attempts") every test. Then add a method that checks the attempts property and returns a response based on its value.
Setting a "attempts" cookie on the response and adding cookie parsing to urllib3. Are we even supposed to do this, for example if someone sets a cookie on a 3xx response? However I am not looking forward to adding cookies.
Mocking _make_request to side effect different things - I know it's not great to use mocks but the mock library does have support for this.
Using the same approach as the retries test in test_socketlevel.py, which is a bit lower level than I'd like but will do just fine.
The text was updated successfully, but these errors were encountered:
I'm trying to work on the retry branch again. To test things I'd like to make a request that fails once or twice and then finally succeeds. However, each of the methods in
dummyserver/handlers.py
is idempotent, which makes this a little bit tricky.I'm considering the following:
_make_request
to side effect different things - I know it's not great to use mocks but the mock library does have support for this.The text was updated successfully, but these errors were encountered: