◐ Shell
reader mode source ↗
Skip to content

bpo-36019: Use pythontest.net instead of example.com#11941

Merged
vstinner merged 17 commits into
python:masterfrom
matrixise:bpo-36019
Feb 22, 2019
Merged

bpo-36019: Use pythontest.net instead of example.com#11941
vstinner merged 17 commits into
python:masterfrom
matrixise:bpo-36019

Conversation

@matrixise

@matrixise matrixise commented Feb 19, 2019

Copy link
Copy Markdown
Member

@vstinner

Copy link
Copy Markdown
Member

Can you add a NEWS entry?

@matrixise

Copy link
Copy Markdown
Member Author

Sure but only when my PR won’t be in WIP. Thanks 🙏

@matrixise matrixise changed the title WIP: bpo-36019: Use pythontest.net instead of example.com Feb 19, 2019

@eamanu eamanu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hide comment

Great!. It would be great use https on the future :-)

@vstinner

Copy link
Copy Markdown
Member

It would be great use https on the future :-)

Wait, some tests must not use HTTPS but HTTP. Some tests are written to explicitly test cleartext HTTP (tcp/80). Right now, it seems like: pythontest.net does't redirect to HTTP.

Maybe we should use a constant to test.support for HTTP-only URL.

@matrixise

Copy link
Copy Markdown
Member Author

@vstinner like that?

from test.support import TEST_HTTP_URL
from test.support import TEST_HTTPS_URL

and where

TEST_HTTP_URL='http://www.pythontest.net'
TEST_HTTP_URL='https://www.pythontest.net'

@vstinner

Copy link
Copy Markdown
Member

There is no need for HTTPS yet.

@vstinner

Copy link
Copy Markdown
Member

"`from test.support import TEST_HTTP_URL" LGTM. Maybe just add a short comment where you define the constant to explain the purpose of this URL. I understood that it must be a public HTTP server, it must use HTTP (not HTTPS), and it must support at least GET verb.

@matrixise

Copy link
Copy Markdown
Member Author

ok, I am going to add this "constant" in test/support/__init__.py

@bedevere-bot

Copy link
Copy Markdown

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@vstinner vstinner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hide comment

It seems like you misunderstood what I proposed. The idea of a constant is to adding a constant is to allow to use a different URL without having to update tests. Without your current change, if I modify TEST_HTTP_URL to point to google.com, example.com, etc. A lot of tests fail.

Please restrict the change example.com, and only example.com : https://bugs.python.org/issue36019

10 hidden items Load more…

@vstinner vstinner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hide comment

Another request for testURLread().

I blocked connections to example.com using:

# I added example.com to localhost
$ sudo head /etc/hosts
127.0.0.1   apu localhost localhost.localdomain localhost4 localhost4.localdomain4 example.com
::1         apu localhost localhost.localdomain localhost6 localhost6.localdomain6 example.com

$ host example.com
example.com has address 93.184.216.34
example.com has IPv6 address 2606:2800:220:1:248:1893:25c8:1946

# Reject all connections to example.com
$ sudo iptables -A OUTPUT -d 93.184.216.34 -j REJECT
$ sudo ip6tables -A OUTPUT -d 2606:2800:220:1:248:1893:25c8:1946 -j REJECT

And I modified transient_internet() to get an error:

diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py
index b442070b35..674195e442 100644
--- a/Lib/test/support/__init__.py
+++ b/Lib/test/support/__init__.py
@@ -1483,22 +1483,8 @@ def transient_internet(resource_name, *, timeout=30.0, errnos=()):
     """Return a context manager that raises ResourceDenied when various issues
     with the Internet connection manifest themselves as exceptions."""
     default_errnos = [
-        ('ECONNREFUSED', 111),
-        ('ECONNRESET', 104),
-        ('EHOSTUNREACH', 113),
-        ('ENETUNREACH', 101),
-        ('ETIMEDOUT', 110),
-        # socket.create_connection() fails randomly with
-        # EADDRNOTAVAIL on Travis CI.
-        ('EADDRNOTAVAIL', 99),
     ]
     default_gai_errnos = [
-        ('EAI_AGAIN', -3),
-        ('EAI_FAIL', -4),
-        ('EAI_NONAME', -2),
-        ('EAI_NODATA', -5),
-        # Encountered when trying to resolve IPv6-only hostnames
-        ('WSANO_DATA', 11004),
     ]
 
     denied = ResourceDenied("Resource %r is not available" % resource_name)

Only test_timeout failed because of my patch. So it's good.

@matrixise

Copy link
Copy Markdown
Member Author

@vstinner updated, when you have time.

@vstinner vstinner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hide comment

LGTM.

@miss-islington

Copy link
Copy Markdown
Contributor

Thanks @matrixise for the PR, and @vstinner for merging it 🌮🎉.. I'm working now to backport this PR to: 3.7.
🐍🍒⛏🤖

@bedevere-bot

Copy link
Copy Markdown

GH-11989 is a backport of this pull request to the 3.7 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Feb 22, 2019
…pythonGH-11941)

(cherry picked from commit a40681d)

Co-authored-by: Stéphane Wirtel <stephane@wirtel.be>
miss-islington added a commit that referenced this pull request Feb 22, 2019
…GH-11941)

(cherry picked from commit a40681d)

Co-authored-by: Stéphane Wirtel <stephane@wirtel.be>
matrixise added a commit to matrixise/cpython that referenced this pull request Mar 5, 2019
vstinner pushed a commit that referenced this pull request Mar 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tests Tests in the Lib/test dir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants