diff options
author | Bert JW Regeer <bertjw@regeer.org> | 2020-05-07 00:47:51 -0700 |
---|---|---|
committer | Bert JW Regeer <bertjw@regeer.org> | 2020-08-15 18:55:05 -0700 |
commit | 6bb51a78333004526c2144925e8aad49b0b37a8e (patch) | |
tree | e61932009bd06c3de57267385498163b3b2708e5 | |
parent | b4a0094a2cf21fa76f9d48eb92303dd758c967e2 (diff) | |
download | waitress-6bb51a78333004526c2144925e8aad49b0b37a8e.tar.gz |
We haven't supported Py2.6 in a LONG time
-rw-r--r-- | tests/test_adjustments.py | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/tests/test_adjustments.py b/tests/test_adjustments.py index c6dadea..6347be3 100644 --- a/tests/test_adjustments.py +++ b/tests/test_adjustments.py @@ -1,15 +1,9 @@ -import sys import socket +import sys +import unittest import warnings -from waitress.compat import ( - WIN, -) - -if sys.version_info[:2] == (2, 6): # pragma: no cover - import unittest2 as unittest -else: # pragma: no cover - import unittest +from waitress.compat import WIN class Test_asbool(unittest.TestCase): @@ -59,10 +53,12 @@ class Test_as_socket_list(unittest.TestCase): socket.socket(socket.AF_INET, socket.SOCK_STREAM), socket.socket(socket.AF_INET6, socket.SOCK_STREAM), ] + if hasattr(socket, "AF_UNIX"): sockets.append(socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)) new_sockets = as_socket_list(sockets) self.assertEqual(sockets, new_sockets) + for sock in sockets: sock.close() @@ -76,6 +72,7 @@ class Test_as_socket_list(unittest.TestCase): ] new_sockets = as_socket_list(sockets) self.assertEqual(new_sockets, [sockets[0], sockets[1]]) + for sock in [sock for sock in sockets if isinstance(sock, socket.socket)]: sock.close() @@ -98,6 +95,7 @@ class TestAdjustments(unittest.TestCase): return True except socket.gaierror as e: # Check to see what the error is + if e.errno == socket.EAI_ADDRFAMILY: return False else: @@ -224,6 +222,7 @@ class TestAdjustments(unittest.TestCase): self.assertRaises( ValueError, self._makeOne, listen="127.0.0.1:http", ) + return inst = self._makeOne(listen="127.0.0.1:http 0.0.0.0:https") |