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 (#701)

also fix typo in associated test case
  • Loading branch information
Nothing4You committed Jan 28, 2022
1 parent 018af44 commit b47bef6
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ To be included in 1.0.0 (unreleased)
* Ensure connections are properly closed before raising an InternalError when packet sequence numbers are out of sync #660
* Unix sockets are now internally considered secure, allowing sha256_password and caching_sha2_password auth methods to be used #695
* Test suite now also tests unix socket connections #696
* Fix SSCursor raising InternalError when last result was not fully retrieved #635


0.0.22 (2021-11-14)
Expand Down
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
9 changes: 2 additions & 7 deletions tests/test_sscursor.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import asyncio

import pytest
from pymysql import NotSupportedError, InternalError
from pymysql import NotSupportedError

from aiomysql import ProgrammingError, InterfaceError
from aiomysql.cursors import SSCursor
Expand Down 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 b47bef6

Please sign in to comment.