Fix Transport, DatagramTransport mockup issues.
This commit is contained in:
parent
7a86406746
commit
ea4fba39a6
1 changed files with 11 additions and 13 deletions
|
@ -61,7 +61,6 @@ def mock_network_loop(loop: asyncio.AbstractEventLoop,
|
|||
dht_network[from_addr] = protocol
|
||||
return transport, protocol
|
||||
|
||||
with mock.patch('socket.socket') as mock_socket:
|
||||
mock_sock = mock.Mock(spec=socket.socket)
|
||||
mock_sock.setsockopt = lambda *_: None
|
||||
mock_sock.bind = lambda *_: None
|
||||
|
@ -71,6 +70,5 @@ def mock_network_loop(loop: asyncio.AbstractEventLoop,
|
|||
mock_sock.close = lambda: None
|
||||
mock_sock.type = socket.SOCK_DGRAM
|
||||
mock_sock.fileno = lambda: 7
|
||||
mock_socket.return_value = mock_sock
|
||||
loop.create_datagram_endpoint = create_datagram_endpoint
|
||||
yield
|
||||
|
|
Loading…
Reference in a new issue