tests: Fix warnings

This commit is contained in:
Yury Selivanov 2017-11-24 16:02:36 -05:00
parent 3b210ea61c
commit e19a233fde
3 changed files with 9 additions and 3 deletions

View File

@ -22,7 +22,7 @@ class _TestAioHTTP:
return aiohttp.web.Response(text=PAYLOAD)
asyncio.set_event_loop(self.loop)
app = aiohttp.web.Application(loop=self.loop)
app = aiohttp.web.Application()
app.router.add_get('/', on_request)
f = self.loop.create_server(
@ -33,6 +33,9 @@ class _TestAioHTTP:
port = srv.sockets[0].getsockname()[1]
async def test():
# Make sure we're using the correct event loop.
self.assertIs(asyncio.get_event_loop(), self.loop)
for addr in (('localhost', port),
('127.0.0.1', port)):
async with aiohttp.ClientSession() as client:

View File

@ -823,7 +823,7 @@ class Test_UV_TCP(_TestTCP, tb.UVTestCase):
super().data_received(data)
self.transport.write(expected_response)
lsock = socket.socket()
lsock = socket.socket(socket.AF_INET)
lsock.bind(('127.0.0.1', 0))
lsock.listen(1)
addr = lsock.getsockname()
@ -835,7 +835,7 @@ class Test_UV_TCP(_TestTCP, tb.UVTestCase):
def client():
nonlocal response
try:
csock = socket.socket()
csock = socket.socket(socket.AF_INET)
if client_ssl is not None:
csock = client_ssl.wrap_socket(csock)
csock.connect(addr)

View File

@ -114,6 +114,9 @@ class _TestUDP:
finally:
if s_transport:
s_transport.close()
# let it close
self.loop.run_until_complete(
asyncio.sleep(0.1, loop=self.loop))
def test_create_datagram_endpoint_sock(self):
sock = None