◐ Shell
clean mode source ↗

bpo-36019: Use pythontest.net instead of example.com by matrixise · Pull Request #11941 · python/cpython

Another request for testURLread().

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