Skip to content

Commit 49a7149

Browse files
committed
Fix more tests
1 parent 2eb7917 commit 49a7149

5 files changed

Lines changed: 17 additions & 0 deletions

File tree

Lib/test/test_asyncio/test_base_events.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1939,6 +1939,8 @@ def test_create_datagram_endpoint_sock(self):
19391939
self.assertEqual('CLOSED', protocol.state)
19401940

19411941
@unittest.skipUnless(hasattr(socket, 'AF_UNIX'), 'No UNIX Sockets')
1942+
@unittest.skipIf(sys.platform == 'win32', 'AF_UNIX support for asyncio is '
1943+
'not implemented on Windows for now')
19421944
def test_create_datagram_endpoint_sock_unix(self):
19431945
fut = self.loop.create_datagram_endpoint(
19441946
lambda: MyDatagramProto(create_future=True, loop=self.loop),

Lib/test/test_asyncio/test_events.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1035,6 +1035,9 @@ def test_create_server_reuse_port(self):
10351035
server.close()
10361036

10371037
def _make_unix_server(self, factory, **kwargs):
1038+
if sys.platform == 'win32':
1039+
raise unittest.SkipTest('AF_UNIX support for asyncio is not '
1040+
'implemented on Windows for now')
10381041
path = test_utils.gen_unix_socket_path()
10391042
self.addCleanup(lambda: os.path.exists(path) and os.unlink(path))
10401043

@@ -1072,6 +1075,8 @@ def test_create_unix_server(self):
10721075
server.close()
10731076

10741077
@unittest.skipUnless(hasattr(socket, 'AF_UNIX'), 'No UNIX Sockets')
1078+
@unittest.skipIf(sys.platform == 'win32', 'AF_UNIX support for asyncio is '
1079+
'not implemented on Windows for now')
10751080
def test_create_unix_server_path_socket_error(self):
10761081
proto = MyProto(loop=self.loop)
10771082
sock = socket.socket()

Lib/test/test_asyncio/utils.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,8 @@ def app(environ, start_response):
200200
if hasattr(socket, 'AF_UNIX'):
201201

202202
class UnixHTTPServer(socketserver.UnixStreamServer, HTTPServer):
203+
if sys.platform == 'win32':
204+
allow_reuse_address = False
203205

204206
def server_bind(self):
205207
socketserver.UnixStreamServer.server_bind(self)
@@ -243,6 +245,9 @@ def gen_unix_socket_path():
243245

244246
@contextlib.contextmanager
245247
def unix_socket_path():
248+
if sys.platform == 'win32':
249+
raise unittest.SkipTest('AF_UNIX support for asyncio is not '
250+
'implemented on Windows for now')
246251
path = gen_unix_socket_path()
247252
try:
248253
yield path
@@ -255,6 +260,9 @@ def unix_socket_path():
255260

256261
@contextlib.contextmanager
257262
def run_test_unix_server(*, use_ssl=False):
263+
if sys.platform == 'win32':
264+
raise unittest.SkipTest('AF_UNIX support for asyncio is not '
265+
'implemented on Windows for now')
258266
with unix_socket_path() as path:
259267
yield from _run_test_server(address=path, use_ssl=use_ssl,
260268
server_cls=SilentUnixWSGIServer,

Lib/test/test_pathlib/test_pathlib.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2747,6 +2747,7 @@ def test_is_socket_false(self):
27472747
@unittest.skipIf(
27482748
is_wasi, "Cannot create socket on WASI."
27492749
)
2750+
@unittest.skipIf(sys.platform=='win32', "didn't work on Windows")
27502751
def test_is_socket_true(self):
27512752
P = self.cls(self.base, 'mysock')
27522753
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)

Lib/test/test_stat.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ def test_devices(self):
215215
break
216216

217217
@socket_helper.skip_unless_bind_unix_socket
218+
@unittest.skipIf(sys.platform=='win32', "didn't work on Windows")
218219
def test_socket(self):
219220
with socket.socket(socket.AF_UNIX) as s:
220221
s.bind(TESTFN)

0 commit comments

Comments
 (0)