mirror of
https://github.com/python/cpython.git
synced 2025-08-30 05:35:08 +00:00
Issue #28704: Fix create_unix_server to support Path-like objects
This commit is contained in:
parent
0ed20cdfb7
commit
d7c151871e
2 changed files with 18 additions and 0 deletions
|
@ -4,6 +4,7 @@ import collections
|
|||
import errno
|
||||
import io
|
||||
import os
|
||||
import pathlib
|
||||
import signal
|
||||
import socket
|
||||
import stat
|
||||
|
@ -251,6 +252,15 @@ class SelectorEventLoopUnixSocketTests(test_utils.TestCase):
|
|||
srv.close()
|
||||
self.loop.run_until_complete(srv.wait_closed())
|
||||
|
||||
@unittest.skipUnless(hasattr(os, 'fspath'), 'no os.fspath')
|
||||
def test_create_unix_server_pathlib(self):
|
||||
with test_utils.unix_socket_path() as path:
|
||||
path = pathlib.Path(path)
|
||||
srv_coro = self.loop.create_unix_server(lambda: None, path)
|
||||
srv = self.loop.run_until_complete(srv_coro)
|
||||
srv.close()
|
||||
self.loop.run_until_complete(srv.wait_closed())
|
||||
|
||||
def test_create_unix_server_existing_path_nonsock(self):
|
||||
with tempfile.NamedTemporaryFile() as file:
|
||||
coro = self.loop.create_unix_server(lambda: None, file.name)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue