summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_asyncio/test_unix_events.py
diff options
context:
space:
mode:
authorYury Selivanov <yury@magic.io>2017-11-20 22:26:28 (GMT)
committerGitHub <noreply@github.com>2017-11-20 22:26:28 (GMT)
commit423fd362f8e4d6c867a5afc8ac7cbeeb66cac19c (patch)
tree204591d156333450cc931abfe0e1056e66f2397a /Lib/test/test_asyncio/test_unix_events.py
parent895862aa01793a26e74512befb0c66a1da2587d6 (diff)
downloadcpython-423fd362f8e4d6c867a5afc8ac7cbeeb66cac19c.zip
cpython-423fd362f8e4d6c867a5afc8ac7cbeeb66cac19c.tar.gz
cpython-423fd362f8e4d6c867a5afc8ac7cbeeb66cac19c.tar.bz2
bpo-32066: Support pathlib.Path in create_unix_connection; sock arg should be optional (#4447)
Diffstat (limited to 'Lib/test/test_asyncio/test_unix_events.py')
-rw-r--r--Lib/test/test_asyncio/test_unix_events.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/Lib/test/test_asyncio/test_unix_events.py b/Lib/test/test_asyncio/test_unix_events.py
index d558842..fe758ba 100644
--- a/Lib/test/test_asyncio/test_unix_events.py
+++ b/Lib/test/test_asyncio/test_unix_events.py
@@ -251,7 +251,6 @@ 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)
@@ -260,6 +259,15 @@ class SelectorEventLoopUnixSocketTests(test_utils.TestCase):
srv.close()
self.loop.run_until_complete(srv.wait_closed())
+ def test_create_unix_connection_pathlib(self):
+ with test_utils.unix_socket_path() as path:
+ path = pathlib.Path(path)
+ coro = self.loop.create_unix_connection(lambda: None, path)
+ with self.assertRaises(FileNotFoundError):
+ # If pathlib.Path wasn't supported, the exception would be
+ # different.
+ self.loop.run_until_complete(coro)
+
def test_create_unix_server_existing_path_nonsock(self):
with tempfile.NamedTemporaryFile() as file:
coro = self.loop.create_unix_server(lambda: None, file.name)
@@ -319,7 +327,7 @@ class SelectorEventLoopUnixSocketTests(test_utils.TestCase):
def test_create_unix_connection_path_inetsock(self):
sock = socket.socket()
with sock:
- coro = self.loop.create_unix_connection(lambda: None, path=None,
+ coro = self.loop.create_unix_connection(lambda: None,
sock=sock)
with self.assertRaisesRegex(ValueError,
'A UNIX Domain Stream.*was expected'):