Travis doesn't support IPv6 on osx and linux with sudo

This commit is contained in:
Unrud 2018-09-06 10:50:55 +02:00
parent 8fe2d987e0
commit 7760f4edf0

View File

@ -26,7 +26,6 @@ import ssl
import tempfile
import threading
import time
import warnings
from urllib import request
from urllib.error import HTTPError, URLError
@ -109,10 +108,11 @@ class TestBaseServerRequests:
assert status == 302
def test_ipv6(self):
if not server.HAS_IPV6:
if (not server.HAS_IPV6 or os.environ.get("TRAVIS_OS_NAME") == "osx" or
os.environ.get("TRAVIS_SUDO") == "true"):
pytest.skip("IPv6 not support")
if os.name == "nt" and os.environ.get("WINE_PYTHON"):
warnings.warn("WORKAROUND: incomplete errno conversion in WINE")
if os.name == "nt" and server.EAI_ADDRFAMILY is None:
# HACK: incomplete errno conversion in WINE
server.EAI_ADDRFAMILY = -9
with socket.socket(socket.AF_INET6, socket.SOCK_STREAM) as sock:
sock.setsockopt(server.IPPROTO_IPV6, server.IPV6_V6ONLY, 1)