Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tracking state in the dummyserver #324

Closed
kevinburke opened this issue Jan 27, 2014 · 2 comments
Closed

Tracking state in the dummyserver #324

kevinburke opened this issue Jan 27, 2014 · 2 comments

Comments

@kevinburke
Copy link
Contributor

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.
@kevinburke
Copy link
Contributor Author

Actually I have another idea which I will share shortly :)

@shazow
Copy link
Member

shazow commented Jan 27, 2014

Why not use socket-level tests?

@shazow shazow closed this as completed Jul 3, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants