Skip to content

Commit

Permalink
Fix aiohttp upgrade (#951)
Browse files Browse the repository at this point in the history
* Revert "set max aiohttp version to 3.5.1 (until build is fixed) (#844)"

This reverts commit b2a4287.

* 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.
  • Loading branch information
cognifloyd authored and hjacobs committed Oct 15, 2019
1 parent 54e50f2 commit bd2552c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion requirements-aiohttp.txt
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
1 change: 1 addition & 0 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down

0 comments on commit bd2552c

Please sign in to comment.