Skip to content

Use server fixture for network test #7374

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
Nov 22, 2019

Conversation

chrahunt
Copy link
Member

@chrahunt chrahunt commented Nov 17, 2019

Working through tests one at a time to help figure out the test server interface. This was one of our longest tests, 13 seconds before and 2 afterwards on my machine.

Progresses #259.

@chrahunt chrahunt added C: tests Testing and related things type: refactor Refactoring code skip news Does not need a NEWS file entry (eg: trivial changes) labels Nov 17, 2019
@chrahunt chrahunt marked this pull request as ready for review November 17, 2019 23:10
os.close(fd)
os.remove(config_file)
mock_server.set_responses([
package_page({}),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would help future test debugging to add a (maybe optional) expected_path_info="/simple1/initools/" arg to package_page (and other fake pages).

pip/tests/lib/server.py

Lines 122 to 127 in 9ae2e64

def responder(environ, start_response):
# type: (Environ, StartResponse) -> Body
start_response("200 OK", [
("Content-Type", "text/html; charset=UTF-8"),
])
return [text.encode('utf-8')]

would return a 500 - Unexpected path_info: /foo/bar while expecting /simple1/initools/.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like it might be easy to get lost in the possible error states - pip would've already done the wrong thing and then it will do more (unexpectedly) in response to the server error.

@chrahunt chrahunt merged commit 81f0572 into pypa:master Nov 22, 2019
@chrahunt chrahunt deleted the maint/use-server-fixture-not-internet branch November 22, 2019 00:32
@lock lock bot added the auto-locked Outdated issues that have been locked by automation label Dec 22, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Dec 22, 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 C: tests Testing and related things skip news Does not need a NEWS file entry (eg: trivial changes) type: refactor Refactoring code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants