From bd2552c313c087d2d0c6a0c80bb7bb6bfc6233d8 Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Tue, 15 Oct 2019 11:42:28 -0500 Subject: [PATCH] Fix aiohttp upgrade (#951) * Revert "set max aiohttp version to 3.5.1 (until build is fixed) (#844)" This reverts commit b2a42874057779beab1ba01b7be80da4749c4654. * Fix test_run_with_aiohttp_not_installed Somewhere between 3.5.1 and 3.5.2, the aiohttp reimport started succeeding (in connexion.connexion.cli.run()). It's not clear which change caused the issue, but it's probably one of: - aio-libs/aiohttp#3469 (Remove wildcard imports) - aio-libs/aiohttp#3464 (Don't suppress gunicorn cleanup errors) - aio-libs/aiohttp#3471 (Refactor workers) - aio-libs/aiohttp#3500 (Ignore done tasks) In any case, setting sys.modules['aiohttp'] = None should prevent reimporting it. See: https://stackoverflow.com/a/1350574 I successfully tested locally on py37 with aiohttp 3.5.1 and 3.5.2. --- requirements-aiohttp.txt | 2 +- setup.py | 2 +- tests/test_cli.py | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/requirements-aiohttp.txt b/requirements-aiohttp.txt index da90e9ddf..c3e1857e0 100644 --- a/requirements-aiohttp.txt +++ b/requirements-aiohttp.txt @@ -1,4 +1,4 @@ -aiohttp>=2.2.5,<3.5.2 +aiohttp>=2.2.5 aiohttp-swagger>=1.0.5 ujson>=1.35 aiohttp_jinja2==0.15.0 diff --git a/setup.py b/setup.py index ed14c0ffd..a5ff0e82f 100755 --- a/setup.py +++ b/setup.py @@ -35,7 +35,7 @@ def read_version(package): swagger_ui_require = 'swagger-ui-bundle>=0.0.2' flask_require = 'flask>=1.0.4' aiohttp_require = [ - 'aiohttp>=2.3.10,<3.5.2', + 'aiohttp>=2.3.10', 'aiohttp-jinja2>=0.14.0' ] ujson_require = 'ujson>=1.35' diff --git a/tests/test_cli.py b/tests/test_cli.py index cd7624f53..f7bcbe136 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -262,6 +262,7 @@ def test_run_with_wsgi_containers(mock_app_run, spec_file): def test_run_with_aiohttp_not_installed(mock_app_run, spec_file): import sys aiohttp_bkp = sys.modules.pop('aiohttp', None) + sys.modules['aiohttp'] = None runner = CliRunner()