Commit 51efd17d authored by Jason Madden's avatar Jason Madden

Merge branch 'issue1389'

parents 19df34fc 3deb1c4e
...@@ -18,17 +18,14 @@ ...@@ -18,17 +18,14 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE. # THE SOFTWARE.
from . import support
from .sysinfo import PY3 from .sysinfo import PY3
from .sysinfo import PYPY from .sysinfo import PYPY
from .sysinfo import WIN from .sysinfo import WIN
from .sysinfo import LIBUV from .sysinfo import LIBUV
from .sysinfo import OSX
from .sysinfo import RUNNING_ON_TRAVIS
from .sysinfo import RUNNING_ON_APPVEYOR
from .sysinfo import EXPECT_POOR_TIMER_RESOLUTION from .sysinfo import EXPECT_POOR_TIMER_RESOLUTION
from .sysinfo import RESOLVER_ARES
# Travis is slow and overloaded; Appveyor used to be faster, but # Travis is slow and overloaded; Appveyor used to be faster, but
...@@ -47,33 +44,18 @@ else: ...@@ -47,33 +44,18 @@ else:
LARGE_TIMEOUT = max(LOCAL_TIMEOUT, CI_TIMEOUT) LARGE_TIMEOUT = max(LOCAL_TIMEOUT, CI_TIMEOUT)
DEFAULT_LOCAL_HOST_ADDR = 'localhost' # Previously we set this manually to 'localhost'
DEFAULT_LOCAL_HOST_ADDR6 = DEFAULT_LOCAL_HOST_ADDR # and then had some conditions where we changed it to
DEFAULT_BIND_ADDR = '' # 127.0.0.1 (e.g., on Windows or OSX or travis), but Python's test.support says
# # Don't use "localhost", since resolving it uses the DNS under recent
# # Windows versions (see issue #18792).
# and sets it unconditionally to 127.0.0.1.
DEFAULT_LOCAL_HOST_ADDR = support.HOST
DEFAULT_LOCAL_HOST_ADDR6 = support.HOSTv6
# Not all TCP stacks support dual binding where ''
# binds to both v4 and v6.
DEFAULT_BIND_ADDR = support.HOST
if RUNNING_ON_TRAVIS or OSX:
# As of November 2017 (probably Sept or Oct), after a
# Travis upgrade, using "localhost" no longer works,
# producing 'OSError: [Errno 99] Cannot assign
# requested address'. This is apparently something to do with
# docker containers. Sigh.
# OSX 10.14.3 is also happier using explicit addresses
DEFAULT_LOCAL_HOST_ADDR = '127.0.0.1'
DEFAULT_LOCAL_HOST_ADDR6 = '::1'
# Likewise, binding to '' appears to work, but it cannot be
# connected to with the same error.
DEFAULT_BIND_ADDR = '127.0.0.1'
if RUNNING_ON_APPVEYOR:
DEFAULT_BIND_ADDR = '127.0.0.1'
DEFAULT_LOCAL_HOST_ADDR = '127.0.0.1'
if RESOLVER_ARES and OSX:
# Ares likes to raise "malformed domain name" on '', at least
# on OS X
DEFAULT_BIND_ADDR = '127.0.0.1'
DEFAULT_CONNECT = DEFAULT_LOCAL_HOST_ADDR DEFAULT_CONNECT = DEFAULT_LOCAL_HOST_ADDR
DEFAULT_BIND_ADDR_TUPLE = (DEFAULT_BIND_ADDR, 0) DEFAULT_BIND_ADDR_TUPLE = (DEFAULT_BIND_ADDR, 0)
......
# Copyright (c) 2018 gevent community
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
# A re-export of the support module from Python's test package, with some
# compatibility shims.
# Note that this imports a lot of modules.
# pylint:disable=wildcard-import,unused-wildcard-import
try:
# Renamed from test_support in Python 3,
# *and* in 2.7.14 (but with a BWC module)
from test.support import *
except ImportError:
from test.test_support import *
try:
HOSTv6
except NameError:
HOSTv6 = '::1'
...@@ -237,6 +237,7 @@ if PYPY: ...@@ -237,6 +237,7 @@ if PYPY:
FAILING_TESTS += [ FAILING_TESTS += [
# A few errors and differences: # A few errors and differences:
# AssertionError: ('255.255.255.255', 'http') != gaierror(-2,) # DNS Python
# AssertionError: ('255.255.255.255', 'http') != gaierror(4, 'ARES_ENOTFOUND: Domain name not found') # AssertionError: ('255.255.255.255', 'http') != gaierror(4, 'ARES_ENOTFOUND: Domain name not found')
# AssertionError: OverflowError('port must be 0-65535.',) != ('readthedocs.org', '65535') # AssertionError: OverflowError('port must be 0-65535.',) != ('readthedocs.org', '65535')
# AssertionError: Lists differ: # AssertionError: Lists differ:
......
...@@ -24,6 +24,10 @@ def _find_files_to_ignore(): ...@@ -24,6 +24,10 @@ def _find_files_to_ignore():
'psycopg2_pool.py', 'psycopg2_pool.py',
'geventsendfile.py', 'geventsendfile.py',
] ]
if greentest.PYPY and greentest.RUNNING_ON_APPVEYOR:
# For some reason on Windows with PyPy, this times out,
# when it should be very fast.
result.append("processes.py")
result += [x[14:] for x in glob.glob('test__example_*.py')] result += [x[14:] for x in glob.glob('test__example_*.py')]
finally: finally:
......
...@@ -22,12 +22,11 @@ import gevent ...@@ -22,12 +22,11 @@ import gevent
from gevent import socket from gevent import socket
from gevent.testing import TestCase, main, tcp_listener from gevent.testing import TestCase, main, tcp_listener
from gevent.testing import gc_collect_if_needed
from gevent.testing import skipOnPyPy from gevent.testing import skipOnPyPy
from gevent.testing import params from gevent.testing import params
PYPY = hasattr(sys, 'pypy_version_info')
PY3 = sys.version_info[0] >= 3 PY3 = sys.version_info[0] >= 3
...@@ -91,28 +90,40 @@ class TestGreenIo(TestCase): ...@@ -91,28 +90,40 @@ class TestGreenIo(TestCase):
did_it_work(server) did_it_work(server)
server_greenlet.kill() server_greenlet.kill()
@skipOnPyPy("GC is different") @skipOnPyPy("Takes multiple GCs and issues a warning we can't catch")
def test_del_closes_socket(self): def test_del_closes_socket(self):
import warnings
def accept_once(listener): def accept_once(listener):
# delete/overwrite the original conn # delete/overwrite the original conn
# object, only keeping the file object around # object, only keeping the file object around
# closing the file object should close everything # closing the file object should close everything
# XXX: This is not exactly true on Python 3. # This is not *exactly* true on Python 3. This produces
# This produces a ResourceWarning. # a ResourceWarning, which we silence below. (Previously we actually
oconn = None # *saved* a reference to the socket object, so we
try: # weren't testing what we thought we were.)
conn, _ = listener.accept()
if PY3: # It's definitely not true on PyPy, which needs GC to
oconn = conn # reliably close everything; sometimes this is more than
conn = conn.makefile(mode='wb') # one collection cycle. And PyPy issues a warning with -X
conn.write(b'hello\n') # track-resources that we cannot catch.
conn.close() with warnings.catch_warnings():
_write_to_closed(conn, b'a') warnings.simplefilter('ignore')
finally:
listener.close() try:
if oconn is not None: conn = listener.accept()[0]
oconn.close() # Note that we overwrite the original variable,
# losing our reference to the socket.
conn = conn.makefile(mode='wb')
conn.write(b'hello\n')
conn.close()
_write_to_closed(conn, b'a')
finally:
listener.close()
del listener
del conn
gc_collect_if_needed()
gc_collect_if_needed()
server = tcp_listener() server = tcp_listener()
gevent.spawn(accept_once, server) gevent.spawn(accept_once, server)
...@@ -121,8 +132,14 @@ class TestGreenIo(TestCase): ...@@ -121,8 +132,14 @@ class TestGreenIo(TestCase):
fd = client.makefile() fd = client.makefile()
client.close() client.close()
self.assertEqual(fd.read(), 'hello\n') self.assertEqual(fd.read(), 'hello\n')
# If the socket isn't closed when 'accept_once' finished,
# then this will hang and exceed the timeout
self.assertEqual(fd.read(), '') self.assertEqual(fd.read(), '')
fd.close()
del client
del fd
if __name__ == '__main__': if __name__ == '__main__':
main() main()
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
are not leaked by the hub. are not leaked by the hub.
""" """
from __future__ import print_function from __future__ import print_function
from _socket import socket as c_socket from _socket import socket as c_socket
import sys import sys
if sys.version_info[0] >= 3: if sys.version_info[0] >= 3:
...@@ -40,11 +41,14 @@ else: ...@@ -40,11 +41,14 @@ else:
import _socket import _socket
_socket.socket = Socket _socket.socket = Socket
import gevent.testing as greentest
from gevent import monkey; monkey.patch_all() from gevent import monkey; monkey.patch_all()
from gevent.testing import flaky
from pprint import pformat import gevent.testing as greentest
from gevent.testing import support
from gevent.testing import params
try: try:
from thread import start_new_thread from thread import start_new_thread
except ImportError: except ImportError:
...@@ -60,101 +64,120 @@ SOCKET_TIMEOUT = 0.1 ...@@ -60,101 +64,120 @@ SOCKET_TIMEOUT = 0.1
if greentest.RUNNING_ON_CI: if greentest.RUNNING_ON_CI:
SOCKET_TIMEOUT *= 2 SOCKET_TIMEOUT *= 2
def init_server():
s = socket.socket()
s.settimeout(SOCKET_TIMEOUT)
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
s.bind(('127.0.0.1', 0))
s.listen(5)
return s
class Server(object):
listening = False
client_data = None
server_port = None
def handle_request(s, raise_on_timeout): def __init__(self, raise_on_timeout):
try: self.raise_on_timeout = raise_on_timeout
conn, _ = s.accept() self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
except socket.timeout: try:
if raise_on_timeout: self.server_port = support.bind_port(self.socket, params.DEFAULT_BIND_ADDR)
except:
self.close()
raise raise
return
#print('handle_request - accepted') def close(self):
res = conn.recv(100) self.socket.close()
assert res == b'hello', repr(res) self.socket = None
#print('handle_request - recvd %r' % res)
res = conn.send(b'bye') def handle_request(self):
#print('handle_request - sent %r' % res)
#print('handle_request - conn refcount: %s' % sys.getrefcount(conn))
conn.close()
def make_request(port):
#print('make_request')
s = socket.socket()
s.connect(('127.0.0.1', port))
#print('make_request - connected')
res = s.send(b'hello')
#print('make_request - sent %s' % res)
res = s.recv(100)
assert res == b'bye', repr(res)
#print('make_request - recvd %r' % res)
s.close()
def run_interaction(run_client):
s = init_server()
start_new_thread(handle_request, (s, run_client))
if run_client:
port = s.getsockname()[1]
start_new_thread(make_request, (port, ))
sleep(0.1 + SOCKET_TIMEOUT)
#print(sys.getrefcount(s._sock))
#s.close()
w = weakref.ref(s._sock)
s.close()
if greentest.WIN:
# The background thread may not have even had a chance to run
# yet, sleep again to be sure it does. Otherwise there could be
# strong refs to the socket still around.
try: try:
sleep(0.1 + SOCKET_TIMEOUT) self.socket.settimeout(SOCKET_TIMEOUT)
except Exception: # pylint:disable=broad-except
pass self.socket.listen(5)
return w self.listening = True
def run_and_check(run_client):
w = run_interaction(run_client=run_client)
if greentest.PYPY:
# PyPy doesn't use a strict ref counting and must
# run a gc, but the object should be gone
gc.collect()
if w():
print(pformat(gc.get_referrers(w())))
for x in gc.get_referrers(w()):
print(pformat(x))
for y in gc.get_referrers(x):
print('-', pformat(y))
raise AssertionError('server should be dead by now')
@greentest.skipOnCI("Often fail with timeouts or force closed connections; not sure why.")
@greentest.skipIf(
greentest.RUN_LEAKCHECKS and greentest.PY3,
"Often fail with force closed connections; not sure why. "
)
class Test(greentest.TestCase):
try:
conn, _ = self.socket.accept()
except socket.timeout:
if self.raise_on_timeout:
raise
return
try:
self.client_data = conn.recv(100)
conn.send(b'bye')
finally:
conn.close()
finally:
self.close()
class Client(object):
server_data = None
def __init__(self, server_port):
self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.server_port = server_port
def close(self):
self.socket.close()
self.socket = None
def make_request(self):
try:
self.socket.connect((params.DEFAULT_CONNECT, self.server_port))
self.socket.send(b'hello')
self.server_data = self.socket.recv(100)
finally:
self.close()
class Test(greentest.TestCase):
__timeout__ = greentest.LARGE_TIMEOUT __timeout__ = greentest.LARGE_TIMEOUT
@flaky.reraises_flaky_timeout(socket.timeout) def run_interaction(self, run_client):
server = Server(raise_on_timeout=run_client)
wref_to_hidden_server_socket = weakref.ref(server.socket._sock)
client = None
start_new_thread(server.handle_request)
if run_client:
client = Client(server.server_port)
start_new_thread(client.make_request)
# Wait until we do our business; we will always close
# the server; We may also close the client.
# On PyPy, we may not actually see the changes they write to
# their dicts immediately.
for obj in server, client:
if obj is None:
continue
while obj.socket is not None:
sleep(0.01)
# If we have a client, then we should have data
if run_client:
self.assertEqual(server.client_data, b'hello')
self.assertEqual(client.server_data, b'bye')
return wref_to_hidden_server_socket
def run_and_check(self, run_client):
wref_to_hidden_server_socket = self.run_interaction(run_client=run_client)
greentest.gc_collect_if_needed()
if wref_to_hidden_server_socket():
from pprint import pformat
print(pformat(gc.get_referrers(wref_to_hidden_server_socket())))
for x in gc.get_referrers(wref_to_hidden_server_socket()):
print(pformat(x))
for y in gc.get_referrers(x):
print('-', pformat(y))
self.fail('server socket should be dead by now')
def test_clean_exit(self): def test_clean_exit(self):
run_and_check(True) self.run_and_check(True)
run_and_check(True) self.run_and_check(True)
@flaky.reraises_flaky_timeout(socket.timeout)
def test_timeout_exit(self): def test_timeout_exit(self):
run_and_check(False) self.run_and_check(False)
run_and_check(False) self.run_and_check(False)
if __name__ == '__main__': if __name__ == '__main__':
......
# This line can be commented out so that most tests run with the
# system socket for comparison.
from gevent import monkey; monkey.patch_all() from gevent import monkey; monkey.patch_all()
import sys import sys
...@@ -9,8 +11,10 @@ import time ...@@ -9,8 +11,10 @@ import time
import unittest import unittest
import gevent.testing as greentest import gevent.testing as greentest
from functools import wraps from functools import wraps
from gevent.testing import six from gevent.testing import six
from gevent.testing import LARGE_TIMEOUT from gevent.testing import LARGE_TIMEOUT
from gevent.testing import support
# we use threading on purpose so that we can test both regular and gevent sockets with the same code # we use threading on purpose so that we can test both regular and gevent sockets with the same code
from threading import Thread as _Thread from threading import Thread as _Thread
...@@ -294,25 +298,31 @@ class TestTCP(greentest.TestCase): ...@@ -294,25 +298,31 @@ class TestTCP(greentest.TestCase):
def test_connect_ex_nonblocking_bad_connection(self): def test_connect_ex_nonblocking_bad_connection(self):
# Issue 841 # Issue 841
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.setblocking(False) try:
ret = s.connect_ex((greentest.DEFAULT_LOCAL_HOST_ADDR, get_port())) s.setblocking(False)
self.assertIsInstance(ret, errno_types) ret = s.connect_ex((greentest.DEFAULT_LOCAL_HOST_ADDR, support.find_unused_port()))
s.close() self.assertIsInstance(ret, errno_types)
finally:
s.close()
def test_connect_ex_gaierror(self): def test_connect_ex_gaierror(self):
# Issue 841 # Issue 841
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
with self.assertRaises(socket.gaierror): try:
s.connect_ex(('foo.bar.fizzbuzz', get_port())) with self.assertRaises(socket.gaierror):
s.close() s.connect_ex(('foo.bar.fizzbuzz', support.find_unused_port()))
finally:
s.close()
def test_connect_ex_nonblocking_overflow(self): def test_connect_ex_nonblocking_overflow(self):
# Issue 841 # Issue 841
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.setblocking(False) try:
with self.assertRaises(OverflowError): s.setblocking(False)
s.connect_ex((greentest.DEFAULT_LOCAL_HOST_ADDR, 65539)) with self.assertRaises(OverflowError):
s.close() s.connect_ex((greentest.DEFAULT_LOCAL_HOST_ADDR, 65539))
finally:
s.close()
@unittest.skipUnless(hasattr(socket, 'SOCK_CLOEXEC'), @unittest.skipUnless(hasattr(socket, 'SOCK_CLOEXEC'),
"Requires SOCK_CLOEXEC") "Requires SOCK_CLOEXEC")
...@@ -340,25 +350,34 @@ class TestTCP(greentest.TestCase): ...@@ -340,25 +350,34 @@ class TestTCP(greentest.TestCase):
acceptor.join() acceptor.join()
def get_port():
tempsock = socket.socket()
tempsock.bind(('', 0))
port = tempsock.getsockname()[1]
tempsock.close()
return port
class TestCreateConnection(greentest.TestCase): class TestCreateConnection(greentest.TestCase):
__timeout__ = LARGE_TIMEOUT __timeout__ = LARGE_TIMEOUT
def test_refuses(self): def test_refuses(self, **conn_args):
with self.assertRaises(socket.error) as cm: connect_port = support.find_unused_port()
socket.create_connection((greentest.DEFAULT_BIND_ADDR, get_port()), with self.assertRaisesRegex(
timeout=30, socket.error,
source_address=('', get_port())) # We really expect "connection refused". It's unclear
ex = cm.exception # where/why we would get '[errno -2] name or service not known'
self.assertIn('refused', str(ex).lower()) # but it seems some systems generate that.
# https://github.com/gevent/gevent/issues/1389
'refused|not known'
):
socket.create_connection(
(greentest.DEFAULT_BIND_ADDR, connect_port),
timeout=30,
**conn_args
)
def test_refuses_from_port(self):
source_port = support.find_unused_port()
# Usually we don't want to bind/connect to '', but
# using it as the source is required if we don't want to hang,
# at least on some systems (OS X)
self.test_refuses(source_address=('', source_port))
@greentest.ignores_leakcheck @greentest.ignores_leakcheck
def test_base_exception(self): def test_base_exception(self):
......
...@@ -2,79 +2,92 @@ ...@@ -2,79 +2,92 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import print_function, absolute_import, division from __future__ import print_function, absolute_import, division
import gevent.testing as greentest
import socket import socket
import unittest
import gevent.testing as greentest
from gevent.tests.test__socket_dns import TestCase, add from gevent.tests.test__socket_dns import TestCase, add
from gevent.testing.sysinfo import OSX
from gevent.testing.sysinfo import RESOLVER_NOT_SYSTEM from gevent.testing.sysinfo import RESOLVER_NOT_SYSTEM
from gevent.testing.sysinfo import RESOLVER_DNSPYTHON from gevent.testing.sysinfo import RESOLVER_DNSPYTHON
if not greentest.RUNNING_ON_CI and not RESOLVER_DNSPYTHON:
# We can't control the DNS servers we use there # We can't control the DNS servers on CI (or in general...)
# for the system. This works best with the google DNS servers # for the system. This works best with the google DNS servers
# The getnameinfo test can fail on CI. # The getnameinfo test can fail on CI.
# Previously only Test6_ds failed, but as of Jan 2018, Test6 # Previously only Test6_ds failed, but as of Jan 2018, Test6
# and Test6_google begin to fail: # and Test6_google begin to fail:
# First differing element 0: # First differing element 0:
# 'vm2.test-ipv6.com' # 'vm2.test-ipv6.com'
# 'ip119.gigo.com' # 'ip119.gigo.com'
# - ('vm2.test-ipv6.com', [], ['2001:470:1:18::125']) # - ('vm2.test-ipv6.com', [], ['2001:470:1:18::125'])
# ? --------- ^^ ^^ # ? --------- ^^ ^^
# + ('ip119.gigo.com', [], ['2001:470:1:18::119']) # + ('ip119.gigo.com', [], ['2001:470:1:18::119'])
# ? ^^^^^^^^ ^^ # ? ^^^^^^^^ ^^
class Test6(TestCase): # These are known to work on jamadden's OS X machine using the google
# resolvers (but not with DNSPython; things don't *quite* match)...so
# by default we skip the tests everywhere else.
# host that only has AAAA record class Test6(TestCase):
host = 'aaaa.test-ipv6.com'
def test_empty(self): # host that only has AAAA record
self._test('getaddrinfo', self.host, 'http') host = 'aaaa.test-ipv6.com'
def test_inet(self): if not OSX or RESOLVER_DNSPYTHON:
self._test('getaddrinfo', self.host, None, socket.AF_INET) def _test(self, *args): # pylint:disable=arguments-differ
raise unittest.SkipTest(
"Only known to work on jamadden's machine. "
"Please help investigate and make DNS tests more robust."
)
def test_inet6(self): def test_empty(self):
self._test('getaddrinfo', self.host, None, socket.AF_INET6) self._test('getaddrinfo', self.host, 'http')
def test_unspec(self): def test_inet(self):
self._test('getaddrinfo', self.host, None, socket.AF_UNSPEC) self._test('getaddrinfo', self.host, None, socket.AF_INET)
def test_inet6(self):
self._test('getaddrinfo', self.host, None, socket.AF_INET6)
class Test6_google(Test6): def test_unspec(self):
host = 'ipv6.google.com' self._test('getaddrinfo', self.host, None, socket.AF_UNSPEC)
def _normalize_result_getnameinfo(self, result):
if greentest.RUNNING_ON_CI and RESOLVER_NOT_SYSTEM:
# Disabled, there are multiple possibilities
# and we can get different ones, rarely.
return ()
return result
add(Test6, Test6.host) class Test6_google(Test6):
add(Test6_google, Test6_google.host) host = 'ipv6.google.com'
def _normalize_result_getnameinfo(self, result):
if greentest.RUNNING_ON_CI and RESOLVER_NOT_SYSTEM:
# Disabled, there are multiple possibilities
# and we can get different ones, rarely.
return ()
return result
add(Test6, Test6.host)
add(Test6_google, Test6_google.host)
class Test6_ds(Test6):
# host that has both A and AAAA records
host = 'ds.test-ipv6.com'
def _normalize_result_gethostbyaddr(self, result):
# This test is effectively disabled. There are multiple address
# that resolve and which ones you get depend on the settings
# of the system and ares. They don't match exactly.
return ()
_normalize_result_gethostbyname = _normalize_result_gethostbyaddr class Test6_ds(Test6):
# host that has both A and AAAA records
host = 'ds.test-ipv6.com'
def _normalize_result_gethostbyaddr(self, result):
# This test is effectively disabled. There are multiple address
# that resolve and which ones you get depend on the settings
# of the system and ares. They don't match exactly.
return ()
_normalize_result_gethostbyname = _normalize_result_gethostbyaddr
add(Test6_ds, Test6_ds.host) add(Test6_ds, Test6_ds.host)
if __name__ == '__main__': if __name__ == '__main__':
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment