-
-
Notifications
You must be signed in to change notification settings - Fork 710
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test the e.errno != socket.EAI_NONAME branch in tcp._getaddrinfo
- Loading branch information
Showing
1 changed file
with
20 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
from __future__ import annotations | ||
|
||
import socket | ||
|
||
import pytest | ||
|
||
from distributed.comm.tcp import TCPConnector | ||
|
||
|
||
# cover the `if e.errno != socket.EAI_NONAME` branch of tcp._getaddrinfo | ||
def test_getaddrinfo_invalid_af(): | ||
with pytest.raises(socket.gaierror) as exc_info: | ||
( | ||
TCPConnector() | ||
.client.connect(host="::1", port=1234, af=socket.AF_INET) | ||
.__await__() | ||
# test that getaddrinfo is called without yielding to the event loop | ||
.send(None) | ||
) | ||
assert exc_info.value.errno == socket.EAI_ADDRFAMILY |