|
22 | 22 | import unittest |
23 | 23 | from unittest import mock |
24 | 24 | import weakref |
| 25 | +from test import support |
25 | 26 |
|
26 | 27 | if sys.platform != 'win32': |
27 | 28 | import tty |
@@ -470,7 +471,7 @@ def test_sock_client_ops(self): |
470 | 471 | sock = socket.socket() |
471 | 472 | self._basetest_sock_recv_into(httpd, sock) |
472 | 473 |
|
473 | | - @unittest.skipUnless(hasattr(socket, 'AF_UNIX'), 'No UNIX Sockets') |
| 474 | + @support.skip_unless_bind_unix_socket |
474 | 475 | def test_unix_sock_client_ops(self): |
475 | 476 | with test_utils.run_test_unix_server() as httpd: |
476 | 477 | sock = socket.socket(socket.AF_UNIX) |
@@ -606,7 +607,7 @@ def test_create_connection(self): |
606 | 607 | lambda: MyProto(loop=self.loop), *httpd.address) |
607 | 608 | self._basetest_create_connection(conn_fut) |
608 | 609 |
|
609 | | - @unittest.skipUnless(hasattr(socket, 'AF_UNIX'), 'No UNIX Sockets') |
| 610 | + @support.skip_unless_bind_unix_socket |
610 | 611 | def test_create_unix_connection(self): |
611 | 612 | # Issue #20682: On Mac OS X Tiger, getsockname() returns a |
612 | 613 | # zero-length address for UNIX socket. |
@@ -736,8 +737,8 @@ def test_create_ssl_connection(self): |
736 | 737 | self._test_create_ssl_connection(httpd, create_connection, |
737 | 738 | peername=httpd.address) |
738 | 739 |
|
| 740 | + @support.skip_unless_bind_unix_socket |
739 | 741 | @unittest.skipIf(ssl is None, 'No ssl module') |
740 | | - @unittest.skipUnless(hasattr(socket, 'AF_UNIX'), 'No UNIX Sockets') |
741 | 742 | def test_create_ssl_unix_connection(self): |
742 | 743 | # Issue #20682: On Mac OS X Tiger, getsockname() returns a |
743 | 744 | # zero-length address for UNIX socket. |
@@ -961,7 +962,7 @@ def _make_unix_server(self, factory, **kwargs): |
961 | 962 |
|
962 | 963 | return server, path |
963 | 964 |
|
964 | | - @unittest.skipUnless(hasattr(socket, 'AF_UNIX'), 'No UNIX Sockets') |
| 965 | + @support.skip_unless_bind_unix_socket |
965 | 966 | def test_create_unix_server(self): |
966 | 967 | proto = MyProto(loop=self.loop) |
967 | 968 | server, path = self._make_unix_server(lambda: proto) |
@@ -1053,8 +1054,8 @@ def test_create_server_ssl(self): |
1053 | 1054 | # stop serving |
1054 | 1055 | server.close() |
1055 | 1056 |
|
| 1057 | + @support.skip_unless_bind_unix_socket |
1056 | 1058 | @unittest.skipIf(ssl is None, 'No ssl module') |
1057 | | - @unittest.skipUnless(hasattr(socket, 'AF_UNIX'), 'No UNIX Sockets') |
1058 | 1059 | def test_create_unix_server_ssl(self): |
1059 | 1060 | proto = MyProto(loop=self.loop) |
1060 | 1061 | server, path = self._make_ssl_unix_server( |
@@ -1113,8 +1114,8 @@ def test_create_server_ssl_verify_failed(self): |
1113 | 1114 | self.assertIsNone(proto.transport) |
1114 | 1115 | server.close() |
1115 | 1116 |
|
| 1117 | + @support.skip_unless_bind_unix_socket |
1116 | 1118 | @unittest.skipIf(ssl is None, 'No ssl module') |
1117 | | - @unittest.skipUnless(hasattr(socket, 'AF_UNIX'), 'No UNIX Sockets') |
1118 | 1119 | def test_create_unix_server_ssl_verify_failed(self): |
1119 | 1120 | proto = MyProto(loop=self.loop) |
1120 | 1121 | server, path = self._make_ssl_unix_server( |
@@ -1171,8 +1172,8 @@ def test_create_server_ssl_match_failed(self): |
1171 | 1172 | proto.transport.close() |
1172 | 1173 | server.close() |
1173 | 1174 |
|
| 1175 | + @support.skip_unless_bind_unix_socket |
1174 | 1176 | @unittest.skipIf(ssl is None, 'No ssl module') |
1175 | | - @unittest.skipUnless(hasattr(socket, 'AF_UNIX'), 'No UNIX Sockets') |
1176 | 1177 | def test_create_unix_server_ssl_verified(self): |
1177 | 1178 | proto = MyProto(loop=self.loop) |
1178 | 1179 | server, path = self._make_ssl_unix_server( |
|
0 commit comments