-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Fix breakage introduced by 8f591682 #2861
Conversation
To note: this breakage did not make it into any shipped version of requests, so we don't need to schedule a patch release for this. |
Why is the build failing? |
Good question. The test behaves fine on my
|
Hmm, so this failure is intermittent on my machine. |
(my machine == Linux box I found) |
I wonder if this is actually a problem with the WSGI server being used by pytest-httpbin. Specifically, I think it might be related to the speed of the server. |
Specifically, I think what's happening here is that the chunked-encoding header is being stripped, and so the server is sending the 200 right away and then killing the connection. This works sometimes because the socket sends happen before the connection is closed, but sometimes the server closes the connection before we can get there. This is pretty annoying, because it means it's likely very hard to find a good test-case here. |
More importantly, it means we can't really have tests at all for chunked transfer encoding. |
I honestly don't know what to do about this. To get a test that confirms we don't break this we need either to change the WSGI server used by pytest-httpbin (the only options are ones that are really heavyweight and probably not suitable) or start writing new tests that don't use a httpbin at all. The second is plenty do-able, it just requires some py.test test fixtures and some socket work. But it makes me a bit nervous given @kennethreitz's attitude to changing our test layout in the past: I'd want to move all the tests to a @kennethreitz, do you have any objection to me adding some more thorough testing around here? The reality is that our chunked upload logic is entirely untested, and has been since it was originally written. That is a recipe for accidental breakage, and it makes me really nervous. |
Ok, so I pushed a new commit that doesn't contain the test. This should pass, and the fix is right, but I don't want us to lose track of the need for better testing here so I'm going to open a separate issue for that. |
@sigmavirus24 This should be good to merge. |
@Lukasa I'm 👍 but I think we should work on fixing our test suite. If Kenneth comes along and decimates it again, then we at least had test coverage for some period of time there. |
Fix breakage introduced by 8f59168
Turns out we broke chunked uploads in 8f59168. I discovered this while investigating #2215.
While we were here, I added a test that would at least have caught errors as egregious as this one.