Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix aiomysql.sa in Python 3.7 and run tests for python 3.7 in CI #434

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
dist: xenial
language: python

python:
- 3.5.3
- 3.6
- 3.7

env:
matrix:
Expand All @@ -11,22 +13,27 @@ env:

services:
- docker
- mysql

matrix:
include:
- python: 3.6
dist: trusty
webknjaz marked this conversation as resolved.
Show resolved Hide resolved
env: PYTHONASYNCIODEBUG=
addons:
mariadb: 5.5
- python: 3.6
dist: trusty
env: PYTHONASYNCIODEBUG=1
addons:
mariadb: 10.0
- python: 3.6
dist: trusty
env: PYTHONASYNCIODEBUG=
addons:
mariadb: 10.1
- python: 3.6
dist: trusty
env: PYTHONASYNCIODEBUG=
addons:
mysql: 5.7
Expand Down
16 changes: 13 additions & 3 deletions aiomysql/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,19 @@ async def __aexit__(self, exc_type, exc, tb):


class _SAConnectionContextManager(_ContextManager):
async def __aiter__(self):
result = await self._coro
return result
def __aiter__(self):
return self

async def __anext__(self):
if self._obj is None:
self._obj = await self._coro

try:
return (await self._obj.__anext__())
except StopAsyncIteration:
await self._obj.close()
self._obj = None
raise


class _TransactionContextManager(_ContextManager):
Expand Down