mirror of
https://github.com/python/cpython.git
synced 2025-10-17 12:18:23 +00:00
ayncio, Tulip issue 129: BaseEventLoop.sock_connect() now raises an error if
the address is not resolved (hostname instead of an IP address) for AF_INET and AF_INET6 address families.
This commit is contained in:
parent
7dfaa27fdd
commit
28773465e6
5 changed files with 59 additions and 13 deletions
|
@ -1191,6 +1191,18 @@ class EventLoopTestsMixin:
|
|||
{'clock_resolution': self.loop._clock_resolution,
|
||||
'selector': self.loop._selector.__class__.__name__})
|
||||
|
||||
def test_sock_connect_address(self):
|
||||
address = ('www.python.org', 80)
|
||||
for family in (socket.AF_INET, socket.AF_INET6):
|
||||
for sock_type in (socket.SOCK_STREAM, socket.SOCK_DGRAM):
|
||||
sock = socket.socket(family, sock_type)
|
||||
with sock:
|
||||
connect = self.loop.sock_connect(sock, address)
|
||||
with self.assertRaises(ValueError) as cm:
|
||||
self.loop.run_until_complete(connect)
|
||||
self.assertIn('address must be resolved',
|
||||
str(cm.exception))
|
||||
|
||||
|
||||
class SubprocessTestsMixin:
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue