Skip to content

Commit

Permalink
Merge pull request #536 from Gr1N/519-adopt-aiohttp3
Browse files Browse the repository at this point in the history
Adopt aiohttp>=3.0.0 (#519)
  • Loading branch information
jettify authored Feb 28, 2018
2 parents aef7799 + 008a313 commit b24e38e
Show file tree
Hide file tree
Showing 11 changed files with 26 additions and 23 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
language: python

python:
- 3.4
- 3.5
- 3.6

Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Fist of all just clone repository::

$ git clone git@github.com:aio-libs/aiobotocore.git

Create virtualenv with at least python3.4 (older version are not supported).
Create virtualenv with at least python3.5 (older version are not supported).
For example using *virtualenvwrapper* commands could look like::

$ cd aiobotocore
Expand Down
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,12 @@ https://groups.google.com/forum/#!forum/aio-libs

Requirements
------------
* Python_ 3.4+
* Python_ 3.5+
* aiohttp_
* botocore_

.. _Python: https://www.python.org
.. _asyncio: http://docs.python.org/3.4/library/asyncio.html
.. _asyncio: http://docs.python.org/3.5/library/asyncio.html
.. _botocore: https://github.com/boto/botocore
.. _aiohttp: https://github.com/KeepSafe/aiohttp

Expand Down
2 changes: 1 addition & 1 deletion aiobotocore/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from .session import get_session, AioSession

__all__ = ['get_session', 'AioSession']
__version__ = '0.5.4a0'
__version__ = '0.6.0a0'
4 changes: 2 additions & 2 deletions aiobotocore/endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,11 +181,11 @@ def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)

@asyncio.coroutine
def _create_connection(self, req):
def _create_connection(self, req, traces=None):
# connection timeout
try:
with CeilTimeout(self.__wrapped_conn_timeout, loop=self._loop):
return super()._create_connection(req)
return super()._create_connection(req, traces=None)
except asyncio.TimeoutError as exc:
raise aiohttp.ServerTimeoutError(
'Connection timeout '
Expand Down
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,6 @@ Indices and tables

.. _PEP492: https://www.python.org/dev/peps/pep-0492/
.. _Python: https://www.python.org
.. _asyncio: http://docs.python.org/3.4/library/asyncio.html
.. _asyncio: http://docs.python.org/3.5/library/asyncio.html
.. _botocore: https://github.com/boto/botocore
.. _aiohttp: https://github.com/KeepSafe/aiohttp
4 changes: 2 additions & 2 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ moto==1.2.0
pytest-cov==2.5.1
pytest==3.3.1
sphinx==1.6.5
yarl<1.0.0
aiohttp==2.3.3
yarl==1.1.1
aiohttp==3.0.4
botocore==1.8.21
multidict==3.3.2
wrapt==1.10.11
Expand Down
7 changes: 3 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@
# If adding requirements make sure to also add to requirements-dev.txt
install_requires = [
'botocore>=1.8.0, <=1.8.21',
'aiohttp>=2.3.0, <3.0.0',
'aiohttp>=3.0.0',
'multidict>=2.1.4',
'wrapt>=1.10.10',
'packaging>=16.8',
]

PY_VER = sys.version_info

if not PY_VER >= (3, 4, 1):
raise RuntimeError("aiobotocore doesn't support Python earlier than 3.4")
if not PY_VER >= (3, 5, 3):
raise RuntimeError("aiobotocore doesn't support Python earlier than 3.5")


def read(f):
Expand Down Expand Up @@ -49,7 +49,6 @@ def read_version():
'Intended Audience :: Developers',
'Intended Audience :: System Administrators',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Environment :: Web Environment',
Expand Down
9 changes: 7 additions & 2 deletions tests/mock_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import time
import threading
import socket
from unittest import mock


_proxy_bypass = {
Expand Down Expand Up @@ -45,8 +46,12 @@ def _run(self):
app.router.add_route('*', '/{anything:.*}', self.stream_handler)

try:
aiohttp.web.run_app(app, host=host, port=self._port,
loop=self._loop, handle_signals=False)
# We need to mock `.get_event_loop` function and return
# `self._loop` explicitly because from `aiohttp>=3.0.0` we can't
# pass `loop` as a kwargs into `run_app`.
with mock.patch('asyncio.get_event_loop', return_value=self._loop):
aiohttp.web.run_app(app, host=host, port=self._port,
handle_signals=False)
except BaseException:
pytest.fail('unable to start and connect to aiohttp server')
raise
Expand Down
12 changes: 6 additions & 6 deletions tests/test_patches.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,19 @@
# github.com/aio-libs/aiobotocore/pull/248
_READ_TIMEOUT_DIGESTS = {
# for our replacement of _factory and _create_connection
TCPConnector: {'1e6a3c14ce703781253da5cfdc7847b4ae898234'},
TCPConnector: {'42a405b3d0b4aa9a61eb7d72925a5c8e373bec6b'},

# for its inheritance to DataQueue
ResponseHandler: {'5f11c28d0075e36dfec4705891f1c90248202ba4'},
ResponseHandler: {'96d9eb3f04ff80a2acaf2fc18a103db474a3c965'},

# for our replacement of read()
DataQueue: {'8ad4d5df1d016547daea6389707bc656630582e5'},
DataQueue: {'be516f7bcdbf5235218261d8ed1f490d299f611d'},

# for our patch of _wait
StreamReader: {'c0a9a31a8c3e550de5985ab642028983f709b37b'},
StreamReader: {'d4ffb6ae823ef4bfd810aade8601ba7b01aa08ec'},

# for digging into _protocol ( 2.1.x, 2.2.x )
ClientResponse: {'1dc0008e88b3f5ec2f59f6f5f03fae601f4a011d'},
# for digging into _protocol
ClientResponse: {'c2f662e8d641e538ac2a0a0f44c2bf1805167dd1'},
}

# These are guards to our main patches
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist=py34,py36
envlist=py35,py36

[testenv]
deps =
Expand Down

0 comments on commit b24e38e

Please sign in to comment.