-
-
Notifications
You must be signed in to change notification settings - Fork 12
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
Support urllib3 v2 #128
Support urllib3 v2 #128
Conversation
9b16d02
to
651bb6e
Compare
Well, this got a little complicated:
|
This should fail for urllib3 v2 and pass for v1, since no changes have been made to the actual source code yet, and v2 should be incompatible. First stop on the way to fully fixing #116.
Unfortunately, VCR currently records cassettes differently with urllib3 v1 vs v2 (in v2, it records decompressed bodies rather than raw bytes). To handle this, we need to have separate cassettes for the different versions of urllib3. More details in kevin1024/vcrpy#719.
I had hoped the underlying issue was fixed in the Wayback Machine, but it is not. I couldn't find a nicer way to do this in urllib3 v2, so the hack is unfortunately even hackier than it used to be.
A few tests couldn't have their cassettes regenerated because things have changed upstream (in ways that are fine, but the tests need to account for them): - The memento in the basic `get_memento` test has a newer "last" memento. - The non-playbackable memento has started playing back! But I found another that still doesn't play back and switched to use that. - A little more care was needed with regenerating the rate limit tests, since these can make wayback put a longer delay on us during the test.
After thinking about this some more, I decided some more hackery here was a worthwhile cost vs. forcing contributors to figure out how to record separate cassettes for each urllib3 version. We now have a custom serializer for VCR that attempts to paper over the recording differences by automatically compressing and decompressing bodies in cassette files that should have been compressed in urllib3 v2. It is basically a pass-through on urllib3 v1.
c0df3e4
to
7d44077
Compare
Rebased on |
Back in #118 we “fixed” things for urllib3 v2 by marking this package as only compatible with v1, so users wouldn't wind up with bad dependency combinations. However, we ultimately need to actually support urllib3 v2 and remove that limitation, which I intend to do here. Will fix #116.