Ignore ipv6 tests if not supported by os

This commit is contained in:
shortcutme 2020-06-18 17:22:08 +02:00
parent 179e5cb651
commit 97ad084c21
No known key found for this signature in database
GPG Key ID: 5B63BAE6CB9613AE
1 changed files with 11 additions and 0 deletions

View File

@ -9,6 +9,7 @@ import gc
import datetime
import atexit
import threading
import socket
import pytest
import mock
@ -320,6 +321,16 @@ def file_server4(request):
@pytest.fixture
def file_server6(request):
try:
sock = socket.socket(socket.AF_INET6, socket.SOCK_DGRAM)
sock.connect(("::1", 80, 1, 1))
has_ipv6 = True
except OSError:
has_ipv6 = False
if not has_ipv6:
pytest.skip("Ipv6 not supported")
time.sleep(0.1)
file_server6 = FileServer("::1", 1544)
file_server6.ip_external = 'fca5:95d6:bfde:d902:8951:276e:1111:a22c' # Fake external ip