@@ -123,18 +123,21 @@ def test_no_mismatch():
123123 assert not is_fifo (sock )
124124 assert not is_mq_wrapper (sock )
125125 assert not is_socket_inet (sock )
126- assert not is_socket_sockaddr (sock , '127.0.0.1:2000' )
126+ with skip_enosys ():
127+ assert not is_socket_sockaddr (sock , '127.0.0.1:2000' )
127128
128129 fd = sock .fileno ()
129130 assert not is_fifo (fd )
130131 assert not is_mq_wrapper (fd )
131132 assert not is_socket_inet (fd )
132- assert not is_socket_sockaddr (fd , '127.0.0.1:2000' )
133+ with skip_enosys ():
134+ assert not is_socket_sockaddr (fd , '127.0.0.1:2000' )
133135
134136 assert not _is_fifo (fd )
135137 assert not _is_mq_wrapper (fd )
136138 assert not _is_socket_inet (fd )
137- assert not _is_socket_sockaddr (fd , '127.0.0.1:2000' )
139+ with skip_enosys ():
140+ assert not _is_socket_sockaddr (fd , '127.0.0.1:2000' )
138141
139142def test_is_socket ():
140143 with closing_socketpair (socket .AF_UNIX ) as pair :
@@ -145,14 +148,16 @@ def test_is_socket():
145148 assert not is_socket (arg , socket .AF_INET )
146149 assert is_socket (arg , socket .AF_UNIX , socket .SOCK_STREAM )
147150 assert not is_socket (arg , socket .AF_INET , socket .SOCK_DGRAM )
148- assert not is_socket_sockaddr (arg , '8.8.8.8:2000' , socket .SOCK_DGRAM , 0 , 0 )
151+ with skip_enosys ():
152+ assert not is_socket_sockaddr (arg , '8.8.8.8:2000' , socket .SOCK_DGRAM , 0 , 0 )
149153
150154 assert _is_socket (arg )
151155 assert _is_socket (arg , socket .AF_UNIX )
152156 assert not _is_socket (arg , socket .AF_INET )
153157 assert _is_socket (arg , socket .AF_UNIX , socket .SOCK_STREAM )
154158 assert not _is_socket (arg , socket .AF_INET , socket .SOCK_DGRAM )
155- assert not _is_socket_sockaddr (arg , '8.8.8.8:2000' , socket .SOCK_DGRAM , 0 , 0 )
159+ with skip_enosys ():
160+ assert not _is_socket_sockaddr (arg , '8.8.8.8:2000' , socket .SOCK_DGRAM , 0 , 0 )
156161
157162def test_is_socket_sockaddr ():
158163 with contextlib .closing (socket .socket (socket .AF_INET )) as sock :
@@ -162,24 +167,33 @@ def test_is_socket_sockaddr():
162167
163168 for listening in (0 , 1 ):
164169 for arg in (sock , sock .fileno ()):
165- assert is_socket_sockaddr (arg , '127.0.0.1' , socket .SOCK_STREAM )
166- assert is_socket_sockaddr (arg , '127.0.0.1' + port , socket .SOCK_STREAM )
167-
168- assert is_socket_sockaddr (arg , '127.0.0.1' + port , listening = listening )
169- assert is_socket_sockaddr (arg , '127.0.0.1' + port , listening = - 1 )
170- assert not is_socket_sockaddr (arg , '127.0.0.1' + port , listening = not listening )
170+ with skip_enosys ():
171+ assert is_socket_sockaddr (arg , '127.0.0.1' , socket .SOCK_STREAM )
172+ with skip_enosys ():
173+ assert is_socket_sockaddr (arg , '127.0.0.1' + port , socket .SOCK_STREAM )
174+
175+ with skip_enosys ():
176+ assert is_socket_sockaddr (arg , '127.0.0.1' + port , listening = listening )
177+ with skip_enosys ():
178+ assert is_socket_sockaddr (arg , '127.0.0.1' + port , listening = - 1 )
179+ with skip_enosys ():
180+ assert not is_socket_sockaddr (arg , '127.0.0.1' + port , listening = not listening )
171181
172182 with pytest .raises (ValueError ):
173183 is_socket_sockaddr (arg , '127.0.0.1' , flowinfo = 123456 )
174184
175- assert not is_socket_sockaddr (arg , '129.168.11.11:23' , socket .SOCK_STREAM )
176- assert not is_socket_sockaddr (arg , '127.0.0.1' , socket .SOCK_DGRAM )
185+ with skip_enosys ():
186+ assert not is_socket_sockaddr (arg , '129.168.11.11:23' , socket .SOCK_STREAM )
187+ with skip_enosys ():
188+ assert not is_socket_sockaddr (arg , '127.0.0.1' , socket .SOCK_DGRAM )
177189
178190 with pytest .raises (ValueError ):
179191 _is_socket_sockaddr (arg , '127.0.0.1' , 0 , 123456 )
180192
181- assert not _is_socket_sockaddr (arg , '129.168.11.11:23' , socket .SOCK_STREAM )
182- assert not _is_socket_sockaddr (arg , '127.0.0.1' , socket .SOCK_DGRAM )
193+ with skip_enosys ():
194+ assert not _is_socket_sockaddr (arg , '129.168.11.11:23' , socket .SOCK_STREAM )
195+ with skip_enosys ():
196+ assert not _is_socket_sockaddr (arg , '127.0.0.1' , socket .SOCK_DGRAM )
183197
184198 sock .listen (11 )
185199
0 commit comments