From 41803bc8e67a35e26efe554e8540891232a28365 Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Wed, 22 May 2019 02:06:58 -0500 Subject: [PATCH] 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. --- tests/test_cli.py | 1 + 1 file changed, 1 insertion(+) 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()