From d9e1438c7dc661f548439c6c9562dc4afeecbde3 Mon Sep 17 00:00:00 2001 From: Alexander Mohr Date: Fri, 6 May 2022 11:20:57 -0700 Subject: [PATCH] fix 3.6 support and allow keepalive_timeout to be None (#935) --- .github/workflows/python-package.yml | 2 +- CHANGES.rst | 5 +++++ aiobotocore/__init__.py | 2 +- aiobotocore/config.py | 4 ++-- setup.py | 1 + tests/botocore/test_credentials.py | 7 ++++++- tests/test_config.py | 8 +++++++- 7 files changed, 23 insertions(+), 6 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 4ec491f3..4b0a9186 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -16,7 +16,7 @@ jobs: name: Test strategy: matrix: - pyver: [3.8, 3.9] + pyver: [3.6, 3.8, 3.9] os: [ubuntu] fail-fast: true runs-on: ${{ matrix.os }}-latest diff --git a/CHANGES.rst b/CHANGES.rst index a9e202ca..7d2d937d 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,5 +1,10 @@ Changes ------- +2.3.1 (2022-05-06) +^^^^^^^^^^^^^^^^^^ +* fix 3.6 support +* AioConfig: allow keepalive_timeout to be None (thanks @dnlserrano #933) + 2.3.0 (2022-05-05) ^^^^^^^^^^^^^^^^^^ * fix encoding issue by swapping to AioAWSResponse and AioAWSRequest to behave more diff --git a/aiobotocore/__init__.py b/aiobotocore/__init__.py index 82190396..1c4ddd35 100644 --- a/aiobotocore/__init__.py +++ b/aiobotocore/__init__.py @@ -1 +1 @@ -__version__ = '2.3.0' +__version__ = '2.3.1' diff --git a/aiobotocore/config.py b/aiobotocore/config.py index 57db443b..17449688 100644 --- a/aiobotocore/config.py +++ b/aiobotocore/config.py @@ -38,9 +38,9 @@ def _validate_connector_args(connector_args): raise ParamValidationError( report='{} value must be a boolean'.format(k)) elif k in ['keepalive_timeout']: - if not isinstance(v, (float, int)): + if v is not None and not isinstance(v, (float, int)): raise ParamValidationError( - report='{} value must be a float/int'.format(k)) + report='{} value must be a float/int or None'.format(k)) elif k == 'force_close': if not isinstance(v, bool): raise ParamValidationError( diff --git a/setup.py b/setup.py index 38b026df..0f5ef503 100644 --- a/setup.py +++ b/setup.py @@ -11,6 +11,7 @@ 'aiohttp>=3.3.1', 'wrapt>=1.10.10', 'aioitertools>=0.5.1', + "async_generator ; python_version<'3.7'", ] extras_require = { diff --git a/tests/botocore/test_credentials.py b/tests/botocore/test_credentials.py index 050ab1ed..79e1f01f 100644 --- a/tests/botocore/test_credentials.py +++ b/tests/botocore/test_credentials.py @@ -9,7 +9,12 @@ import sys import tempfile import uuid -from contextlib import asynccontextmanager + +try: + from contextlib import asynccontextmanager +except ImportError: + from async_generator import asynccontextmanager + from datetime import datetime, timedelta import json import subprocess diff --git a/tests/test_config.py b/tests/test_config.py index 5d4b70f6..efef78ec 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -28,6 +28,11 @@ def test_connector_args(): connector_args = dict(force_close="1") AioConfig(connector_args) + with pytest.raises(ParamValidationError): + # wrong type + connector_args = dict(keepalive_timeout="1") + AioConfig(connector_args) + with pytest.raises(ParamValidationError): # wrong type connector_args = dict(ssl_context="1") @@ -43,10 +48,11 @@ def test_connector_args(): connector_args = dict(foo="1") AioConfig(connector_args) - # Test valid config: + # Test valid configs: AioConfig({ "resolver": aiohttp.resolver.DefaultResolver() }) + AioConfig({'keepalive_timeout': None}) # test merge cfg = Config(read_timeout=75)