-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Proposed fix to #1180 (and maybe #932 & #1104) #1902
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
Conversation
This is a rebased final version of a proposed solution to fix issues #932, #1104 & #1180. Following changes have been done: * Implemented a new class `PipXmlrpcTransport` using a contained `PipSession` object. * Modified the `pip/commands/search.py` to make use of the `PipXmlrpcTransport` class. * Properly initialized options for testing `SearchCommand`: - Changed `options_mock` to an `options` object built from `parse_args`, to properly initialize default options.
Hey, sorry this took so long to review, I've been debugging a really wonky issue. This looks pretty good, only thing I'd ask is can you change it so that you have the session in a context manager? like: with self._build_session(...) as session:
pass # Do stuff with the session here This way the connection pool will get closed explicitly? You can see I've made this change to the other commands in #1882. |
* Added a `with` block to handle `session` life-cycle. As commented in #1902
Perfect! I just committed a little patch for it. Now, we can wait for the Travis' report. |
xmlrpc_client.Transport.__init__(self, use_datetime) | ||
index_parts = urlparse.urlparse(index_url) | ||
self._scheme = index_parts.scheme | ||
session.headers.update({'Content-Type': 'text/xml'}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I just noticed this. I'd rather not modify the session in this. Can we just pass this header on each self._session.post
call? That way sessions don't start acting differently just because you used them in PipXmlrpcTransport``.
Real sorry, one more thing I noticed. Also can you add this to changelog? That you've fixed those issues and |
* Changed `PipXmlrpcTransport` to pass headers at request scope * Added summary line to the changelog
It's no problem! I think 0dedf2b made the job. |
Ok this looks pretty good now. Thanks! The tests are failing but they look transient. I kicked them and we'll see if they pass. |
✨ Yay, thanks :) |
This is a rebased final version of a proposed solution to fix
issues #932, #1104 & #1180. Following changes have been done:
PipXmlrpcTransport
using acontained
PipSession
object.pip/commands/search.py
to make use of thePipXmlrpcTransport
class.SearchCommand
:options_mock
to anoptions
object built fromparse_args
, to properly initialize default options.