Skip to content

Commit

Permalink
Fix test_run_with_aiohttp_not_installed
Browse files Browse the repository at this point in the history
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 committed May 22, 2019
1 parent 712b2d2 commit 41803bc
Showing 1 changed file with 1 addition and 0 deletions.
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 41803bc

Please sign in to comment.