Skip to content

Commit

Permalink
bump minimum aiohttp req and add aiohttp tests (#1033)
Browse files Browse the repository at this point in the history
  • Loading branch information
thehesiod committed Aug 11, 2023
1 parent 0a93fb8 commit 2b0bd95
Show file tree
Hide file tree
Showing 13 changed files with 59 additions and 84 deletions.
24 changes: 14 additions & 10 deletions .github/workflows/python-package.yml
Expand Up @@ -12,11 +12,15 @@ on:

jobs:
test:
name: Test ${{ matrix.python-version }}
name: Test Python ${{ matrix.python-version }}
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
python-version: ['3.8', '3.9', '3.10', '3.11']
include:
- aiohttp-version: '==3.7.4.post0'
- aiohttp-version: '<4.0.0'
python-version: '3.11'
fail-fast: true
timeout-minutes: 15
steps:
Expand All @@ -28,17 +32,16 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
# cache: 'pipenv'
- name: Download dependencies
- name: Lock and sync dependencies
env:
AIOHTTP_VERSION: ${{ matrix.aiohttp-version }}
run: |
python -c "import sys; print(f'Python version: {sys.version}')"
python -m pip install -U setuptools pip pipenv codecov wheel
pipenv lock --python ${{ matrix.python-version }}
pipenv sync --dev
pipenv check || true
pipenv graph
python -m pip install -U setuptools pip codecov wheel pip-tools
time pip-compile requirements-dev.in
time pip-sync requirements-dev.txt
- name: Run flake
if: matrix.python-version != '3.7'
if: matrix.python-version == '3.11'
run: |
make flake
- name: Run unittests
Expand All @@ -47,6 +50,7 @@ jobs:
run: |
make mototest
- name: Upload coverage to Codecov
if: matrix.python-version == '3.11'
uses: codecov/codecov-action@v3.1.1
with:
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos
Expand Down
8 changes: 0 additions & 8 deletions .pyup.yml

This file was deleted.

5 changes: 5 additions & 0 deletions CHANGES.rst
@@ -1,5 +1,10 @@
Changes
-------
2.6.0 (2023-08-11)
^^^^^^^^^^^^^^^^^^
* bump aiohttp minimum version to 3.7.4.post0
* drop python 3.7 support (EOL)

2.5.4 (2023-08-07)
^^^^^^^^^^^^^^^^^^
* fix __aenter__ attribute error introduced in refresh bugfix (#1031)
Expand Down
8 changes: 4 additions & 4 deletions CONTRIBUTING.rst
Expand Up @@ -13,17 +13,17 @@ First of all, clone the repository::

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

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

$ cd aiobotocore
$ mkvirtualenv --python=`which python3.5` aiobotocore
$ mkvirtualenv --python=`which python3.8` aiobotocore


After that, please install libraries required for development::

$ pipenv lock
$ pipenv sync --dev
$ pip-compile requirements-dev.in
$ pip-sync requirements-dev.txt

Congratulations, you are ready to run the test suite::

Expand Down
13 changes: 6 additions & 7 deletions Makefile
Expand Up @@ -3,29 +3,28 @@
FLAGS=

flake: checkrst
pipenv run python -m flake8 --format=abspath
python -m flake8 --format=abspath

test: flake
pipenv run python -Wd -m pytest -s -vv $(FLAGS) ./tests/
python -Wd -m pytest -s -vv $(FLAGS) ./tests/

vtest:
pipenv run python -Wd -X tracemalloc=5 -X faulthandler -m pytest -s -vv $(FLAGS) ./tests/
python -Wd -X tracemalloc=5 -X faulthandler -m pytest -s -vv $(FLAGS) ./tests/

checkrst:
pipenv run python setup.py check -rms
python setup.py check -rms

cov cover coverage: flake
pipenv run python -Wd -m pytest -s -vv --cov-report term --cov-report html --cov aiobotocore ./tests
python -Wd -m pytest -s -vv --cov-report term --cov-report html --cov aiobotocore ./tests
@echo "open file://`pwd`/htmlcov/index.html"

# BOTO_CONFIG solves https://github.com/travis-ci/travis-ci/issues/7940
mototest:
docker pull alpine
docker pull lambci/lambda:python3.8
BOTO_CONFIG=/dev/null pipenv run python -Wd -X tracemalloc=5 -X faulthandler -m pytest -vv -m moto -n auto --cov-report term --cov-report html --cov-report xml --cov=aiobotocore --cov=tests --log-cli-level=DEBUG aiobotocore tests
BOTO_CONFIG=/dev/null python -Wd -X tracemalloc=5 -X faulthandler -m pytest -vv -m moto -n auto --cov-report term --cov-report html --cov-report xml --cov=aiobotocore --cov=tests --log-cli-level=DEBUG aiobotocore tests
@echo "open file://`pwd`/htmlcov/index.html"


clean:
rm -rf `find . -name __pycache__`
rm -rf `find . -name .pytest_cache`
Expand Down
30 changes: 0 additions & 30 deletions Pipfile

This file was deleted.

2 changes: 1 addition & 1 deletion README.rst
Expand Up @@ -159,7 +159,7 @@ secret accessible via environment variables:
$ cd aiobotocore
$ export AWS_ACCESS_KEY_ID=xxx
$ export AWS_SECRET_ACCESS_KEY=xxx
$ pipenv sync --dev
$ pip-sync requirements-dev.txt

Execute tests suite:

Expand Down
2 changes: 1 addition & 1 deletion aiobotocore/__init__.py
@@ -1 +1 @@
__version__ = '2.5.4'
__version__ = '2.6.0'
1 change: 0 additions & 1 deletion aiobotocore/response.py
Expand Up @@ -22,7 +22,6 @@ class StreamingBody(wrapt.ObjectProxy):
This provides a few additional conveniences that do not exist
in the urllib3 model:
* Set the timeout on the socket (i.e read() timeouts)
* Auto validation of content length, if the amount of bytes
we read does not match the content length, an exception
is raised.
Expand Down
24 changes: 24 additions & 0 deletions requirements-dev.in
@@ -0,0 +1,24 @@
codecov~=2.1.13
coverage~=7.2.7
flake8~=3.9.0
flake8-formatter-abspath~=1.0.1
flake8-black~=0.3.3
flake8-isort~= 4.1.1
black~=22.6.0
isort~= 5.10.1
docker~=5.0.0
moto[server,s3,sqs,lambda,dynamodb,cloudformation,sns,batch,ec2,rds]~=4.0.0
pytest~=6.2.4
pytest-cov~=4.1.0
pytest-asyncio~=0.14.0
pytest-xdist~=2.2.1

# this is needed for test_patches
dill~=0.3.3

# this is needed when running setup.py check -rms
Pygments

aiohttp${AIOHTTP_VERSION}

-e .[awscli,boto3]
3 changes: 1 addition & 2 deletions setup.py
Expand Up @@ -8,7 +8,7 @@
install_requires = [
# pegged to also match items in `extras_require`
'botocore>=1.31.17,<1.31.18',
'aiohttp>=3.3.1,<4.0.0',
'aiohttp>=3.7.4.post0,<4.0.0',
'wrapt>=1.10.10, <2.0.0',
'aioitertools>=0.5.1,<1.0.0',
]
Expand Down Expand Up @@ -49,7 +49,6 @@ def read_version():
'Natural Language :: English',
'License :: OSI Approved :: Apache Software License',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
Expand Down
21 changes: 2 additions & 19 deletions tests/test_patches.py
@@ -1,10 +1,7 @@
import hashlib
from itertools import chain

import aiohttp
import botocore
import pytest
from aiohttp.client import ClientResponse
from botocore import retryhandler
from botocore.args import ClientArgsCreator
from botocore.awsrequest import AWSResponse
Expand Down Expand Up @@ -115,16 +112,6 @@
# 3) If we need to replace the below hash (not backwards compatible) or add
# to the set

# The follow is for our monkeypatches for read_timeout:
# github.com/aio-libs/aiobotocore/pull/248
_AIOHTTP_DIGESTS = {
# for using _body
ClientResponse: {
'e178726065b609c69a1c02e8bb78f22efce90792',
'225e8033bfcff8cccbc2e975d7bd0c7993f14366',
},
}

# These are guards to our main patches

# !!! README: HOW TO UPDATE THESE !!!
Expand Down Expand Up @@ -672,14 +659,10 @@ def test_protocol_parsers():
# NOTE: this doesn't require moto but needs to be marked to run with coverage
@pytest.mark.moto
def test_patches():
print(
"Botocore version: {} aiohttp version: {}".format(
botocore.__version__, aiohttp.__version__
)
)
print(f"Botocore version: {botocore.__version__}")

success = True
for obj, digests in chain(_AIOHTTP_DIGESTS.items(), _API_DIGESTS.items()):
for obj, digests in _API_DIGESTS.items():

try:
source = getsource(obj)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_version.py
Expand Up @@ -145,7 +145,7 @@ def test_release_versions():
rst_prev_date = rst_prev_ver_groups['date']

if rst_date == 'TBD':
# TODO: we can't pipenv lock if we're a prerelease version
# TODO: we can now lock if we're a prerelease version
pass
# assert (
# rst_ver.is_prerelease
Expand Down

0 comments on commit 2b0bd95

Please sign in to comment.