Skip to content

Commit

Permalink
ensure coroutine is awaited when discarding results in SSCursor, fixes
Browse files Browse the repository at this point in the history
…#635

also fix typo in associated test case
  • Loading branch information
Nothing4You committed Jan 28, 2022
1 parent 018af44 commit 7817dbe
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
2 changes: 1 addition & 1 deletion aiomysql/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -711,7 +711,7 @@ async def _execute_command(self, command, sql):
if self._result is not None:
if self._result.unbuffered_active:
warnings.warn("Previous unbuffered result was left incomplete")
self._result._finish_unbuffered_query()
await self._result._finish_unbuffered_query()
while self._result.has_next:
await self.next_result()
self._result = None
Expand Down
7 changes: 1 addition & 6 deletions tests/test_sscursor.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,11 +190,6 @@ async def read_cursor():
await conn.cursor(SSCursor)


@pytest.mark.xfail(
reason="https://github.com/aio-libs/aiomysql/issues/635",
raises=InternalError,
strict=True,
)
@pytest.mark.run_loop
async def test_sscursor_discarded_result(connection):
conn = connection
Expand All @@ -203,4 +198,4 @@ async def test_sscursor_discarded_result(connection):
await cursor.execute("select 1")
await cursor.execute("select 2")
ret = await cursor.fetchone()
assert (1,) == ret
assert (2,) == ret

0 comments on commit 7817dbe

Please sign in to comment.