Skip to content
This repository has been archived by the owner on Feb 21, 2023. It is now read-only.

Commit

Permalink
fix tests (await syntax)
Browse files Browse the repository at this point in the history
  • Loading branch information
popravich committed Nov 14, 2017
1 parent d4faefb commit 29c360b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
3 changes: 1 addition & 2 deletions aioredis/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,8 +283,7 @@ def execute(self, command, *args, encoding=_NOTSET):
is broken.
"""
if self._reader is None or self._reader.at_eof():
msg = self._close_msg if self._close_msg else\
"Connection closed or corrupted"
msg = self._close_msg or "Connection closed or corrupted"
raise ConnectionClosedError(msg)
if command is None:
raise TypeError("command must not be None")
Expand Down
12 changes: 6 additions & 6 deletions tests/connection_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,16 +107,16 @@ async def test_connect_unixsocket_timeout(create_connection, loop, server):

@pytest.mark.run_loop
@pytest.redis_version(2, 8, 0, reason="maxclients config setting")
def test_connect_maxclients(request, create_connection, loop, start_server):
async def test_connect_maxclients(create_connection, loop, start_server):
server = start_server('server-maxclients')
conn = yield from create_connection(
conn = await create_connection(
server.tcp_address, loop=loop)
yield from conn.execute(b'CONFIG', b'SET', 'maxclients', 1)
await conn.execute(b'CONFIG', b'SET', 'maxclients', 1)

with pytest.raises(MaxClientsError):
conn2 = yield from create_connection(
with pytest.raises((MaxClientsError, ConnectionError)):
conn2 = await create_connection(
server.tcp_address, loop=loop)
yield from conn2.execute('ping')
await conn2.execute('ping')


def test_global_loop(create_connection, loop, server):
Expand Down
2 changes: 1 addition & 1 deletion tests/pool_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ async def test_pool_check_closed_when_exception(
await redis.config_set('maxclients', 2)

with pytest.logs('aioredis', 'DEBUG') as cm:
with pytest.raises(MaxClientsError):
with pytest.raises((MaxClientsError, ConnectionError)):
await create_pool(address=tuple(server.tcp_address),
minsize=3, loop=loop)

Expand Down

0 comments on commit 29c360b

Please sign in to comment.