skip ipv6 tests on sudo-enabled travis builds

This commit is contained in:
Maximilian Hils 2017-10-20 13:37:26 +02:00
parent bf67c734ea
commit 4522f15c89
2 changed files with 18 additions and 0 deletions

View File

@ -1,4 +1,6 @@
import os
import socket
import pytest
pytest_plugins = ('test.full_coverage_plugin',)
@ -17,3 +19,17 @@ skip_appveyor = pytest.mark.skipif(
"APPVEYOR" in os.environ,
reason='Skipping due to Appveyor'
)
try:
s = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
s.bind(("::1", 0))
s.close()
except OSError:
no_ipv6 = True
else:
no_ipv6 = False
skip_no_ipv6 = pytest.mark.skipif(
no_ipv6,
reason='Host has no IPv6 support'
)

View File

@ -12,6 +12,7 @@ from mitmproxy import certs
from mitmproxy.net import tcp
from mitmproxy import exceptions
from mitmproxy.test import tutils
from ...conftest import skip_no_ipv6
from . import tservers
@ -112,6 +113,7 @@ class TestServerBind(tservers.ServerTestBase):
pass
@skip_no_ipv6
class TestServerIPv6(tservers.ServerTestBase):
handler = EchoHandler
addr = ("::1", 0)