Skip to content

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

Merged
merged 3 commits into from
Jul 3, 2014
Merged

Proposed fix to #1180 (and maybe #932 & #1104) #1902

merged 3 commits into from
Jul 3, 2014

Conversation

tnotstar
Copy link
Contributor

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.

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.
@dstufft
Copy link
Member

dstufft commented Jul 3, 2014

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

tnotstar commented Jul 3, 2014

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'})
Copy link
Member

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``.

@dstufft
Copy link
Member

dstufft commented Jul 3, 2014

Real sorry, one more thing I noticed. Also can you add this to changelog? That you've fixed those issues and pip search respects proxies now?

* Changed `PipXmlrpcTransport` to pass headers at request scope
* Added summary line to the changelog
@tnotstar
Copy link
Contributor Author

tnotstar commented Jul 3, 2014

It's no problem! I think 0dedf2b made the job.

@dstufft
Copy link
Member

dstufft commented Jul 3, 2014

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.

dstufft added a commit that referenced this pull request Jul 3, 2014
@dstufft dstufft merged commit d359d1a into pypa:develop Jul 3, 2014
@dstufft
Copy link
Member

dstufft commented Jul 3, 2014

✨ Yay, thanks :)

@lock lock bot added the auto-locked Outdated issues that have been locked by automation label Jun 5, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Jun 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
auto-locked Outdated issues that have been locked by automation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants