mirror of
https://github.com/python/cpython.git
synced 2025-08-30 13:38:43 +00:00
asyncio: Only allow Unix Stream sockets for loop.create_unix_server/connection
This commit is contained in:
parent
95cdf364c8
commit
36e7e97d62
2 changed files with 19 additions and 3 deletions
|
@ -273,7 +273,16 @@ class SelectorEventLoopUnixSocketTests(test_utils.TestCase):
|
|||
coro = self.loop.create_unix_server(lambda: None, path=None,
|
||||
sock=sock)
|
||||
with self.assertRaisesRegex(ValueError,
|
||||
'A UNIX Domain Socket was expected'):
|
||||
'A UNIX Domain Stream.*was expected'):
|
||||
self.loop.run_until_complete(coro)
|
||||
|
||||
def test_create_unix_connection_path_inetsock(self):
|
||||
sock = socket.socket()
|
||||
with sock:
|
||||
coro = self.loop.create_unix_connection(lambda: None, path=None,
|
||||
sock=sock)
|
||||
with self.assertRaisesRegex(ValueError,
|
||||
'A UNIX Domain Stream.*was expected'):
|
||||
self.loop.run_until_complete(coro)
|
||||
|
||||
@mock.patch('asyncio.unix_events.socket')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue