From 43e31c366b79d9e212bcbc9ad7bae788539bd62f Mon Sep 17 00:00:00 2001 From: Diego Oliveira Date: Sat, 26 May 2018 10:42:15 -0300 Subject: [PATCH] Fix gaiohttp worker --- .gitignore | 2 ++ THANKS | 1 + docs/source/news.rst | 8 ++++++++ gunicorn/workers/__init__.py | 2 +- gunicorn/workers/_gaiohttp.py | 2 +- requirements_test.txt | 4 ++-- tests/test_gaiohttp.py | 2 +- 7 files changed, 16 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 2cc38924..c0391bdb 100755 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,5 @@ examples/frameworks/pylonstest/pylonstest.egg-info/ MANIFEST nohup.out setuptools-* +.cache +.eggs diff --git a/THANKS b/THANKS index f23b74ed..ff271ad1 100644 --- a/THANKS +++ b/THANKS @@ -49,6 +49,7 @@ Dariusz Suchojad David Vincelli David Wolever Denis Bilenko +Diego Oliveira Dima Barsky Djoume Salvetti Dmitry Medvinsky diff --git a/docs/source/news.rst b/docs/source/news.rst index 3d90aead..eb9c4e49 100644 --- a/docs/source/news.rst +++ b/docs/source/news.rst @@ -2,6 +2,14 @@ Changelog ========= +19.9.0 / 2018/05/26 +=================== + +- the internal module `gunicorn.workers.async` was renamed to `gunicorn.workers.async` + since ``async`` is now a reserved word in Python 3.7 + (:pr:`1527`) + + 19.8.1 / 2018/04/30 =================== diff --git a/gunicorn/workers/__init__.py b/gunicorn/workers/__init__.py index 05a3e286..fceaa03c 100644 --- a/gunicorn/workers/__init__.py +++ b/gunicorn/workers/__init__.py @@ -17,6 +17,6 @@ SUPPORTED_WORKERS = { } -if sys.version_info >= (3, 3): +if sys.version_info >= (3, 4): # gaiohttp worker can be used with Python 3.3+ only. SUPPORTED_WORKERS["gaiohttp"] = "gunicorn.workers.gaiohttp.AiohttpWorker" diff --git a/gunicorn/workers/_gaiohttp.py b/gunicorn/workers/_gaiohttp.py index cdce4be7..fe378c35 100644 --- a/gunicorn/workers/_gaiohttp.py +++ b/gunicorn/workers/_gaiohttp.py @@ -46,7 +46,7 @@ class AiohttpWorker(base.Worker): super().init_process() def run(self): - self._runner = asyncio.async(self._run(), loop=self.loop) + self._runner = asyncio.ensure_future(self._run(), loop=self.loop) try: self.loop.run_until_complete(self._runner) diff --git a/requirements_test.txt b/requirements_test.txt index a99b558b..30cce5ed 100644 --- a/requirements_test.txt +++ b/requirements_test.txt @@ -1,3 +1,3 @@ coverage>=4.0,<4.4 # TODO: https://github.com/benoitc/gunicorn/issues/1548 -pytest==3.0.5 -pytest-cov==2.4.0 +pytest +pytest-cov diff --git a/tests/test_gaiohttp.py b/tests/test_gaiohttp.py index 6a08c413..e58f36c1 100644 --- a/tests/test_gaiohttp.py +++ b/tests/test_gaiohttp.py @@ -50,7 +50,7 @@ class WorkerTests(unittest.TestCase): self.worker.loop = mock.Mock() self.worker.run() - self.assertTrue(m_asyncio.async.called) + self.assertTrue(m_asyncio.ensure_future.called) self.assertTrue(self.worker.loop.run_until_complete.called) self.assertTrue(self.worker.loop.close.called)