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

Run tests for python 3.7 in CI and fix failing tests #378

Closed
wants to merge 3 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
dist: xenial
sudo: true
language: python

python:
- 3.5.3
- 3.6
- 3.7

env:
matrix:
Expand Down Expand Up @@ -30,6 +33,14 @@ matrix:
env: PYTHONASYNCIODEBUG=
addons:
mysql: 5.7
- python: 3.7
env: PYTHONASYNCIODEBUG=1
addons:
mariadb: 10.1
- python: 3.7
env: PYTHONASYNCIODEBUG=1
addons:
mysql: 5.7


before_script:
Expand Down
2 changes: 1 addition & 1 deletion aiomysql/sa/result.py
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ async def scalar(self):
else:
return None

async def __aiter__(self):
def __aiter__(self):
return self

async def __anext__(self):
Expand Down
18 changes: 15 additions & 3 deletions aiomysql/utils.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import asyncio
from collections.abc import Coroutine


Expand Down Expand Up @@ -70,9 +71,20 @@ 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

@asyncio.coroutine
def __anext__(self):
if self._obj is None:
self._obj = yield from self._coro

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


class _TransactionContextManager(_ContextManager):
Expand Down