From dedf2001808b9e41b2f23ebb53f9f584a7cef24c Mon Sep 17 00:00:00 2001 From: Fantix King Date: Mon, 9 Oct 2023 11:37:19 -0400 Subject: [PATCH] Install aiohttp 3.9.0b0 on Python 3.12 This partially reverts commit 247fb175ae1881a4aad19db34f727876de081751. --- setup.py | 11 ++--------- tests/test_aiohttp.py | 9 +++++++++ 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/setup.py b/setup.py index 2e5cadac..335134fe 100644 --- a/setup.py +++ b/setup.py @@ -28,6 +28,8 @@ # pycodestyle is a dependency of flake8, but it must be frozen because # their combination breaks too often # (example breakage: https://gitlab.com/pycqa/flake8/issues/427) + 'aiohttp>=3.8.1; python_version < "3.12"', + 'aiohttp==3.9.0b0; python_version >= "3.12"', 'flake8~=5.0', 'psutil', 'pycodestyle~=2.9.0', @@ -36,15 +38,6 @@ CYTHON_DEPENDENCY, ] -if vi < (3, 12): - # XXX Revert this change later. - # - # Python 3.12 is new and there's no aiohttp wheel for it yet. - # And pip helfully fails on building a wheel for it and I've - # no idea how to disable that. - TEST_DEPENDENCIES += ['aiohttp>=3.8.1'] - - # Dependencies required to build documentation. DOC_DEPENDENCIES = [ 'Sphinx~=4.1.2', diff --git a/tests/test_aiohttp.py b/tests/test_aiohttp.py index cdf8717b..f930f4b1 100644 --- a/tests/test_aiohttp.py +++ b/tests/test_aiohttp.py @@ -7,6 +7,7 @@ skip_tests = False import asyncio +import sys import unittest import weakref @@ -48,6 +49,14 @@ async def test(): self.loop.run_until_complete(runner.cleanup()) def test_aiohttp_graceful_shutdown(self): + if self.implementation == 'asyncio' and sys.version_info >= (3, 12, 0): + # In Python 3.12.0, asyncio.Server.wait_closed() waits for all + # existing connections to complete, before aiohttp sends + # on_shutdown signals. + # https://github.com/aio-libs/aiohttp/issues/7675#issuecomment-1752143748 + # https://github.com/python/cpython/pull/98582 + raise unittest.SkipTest('bug in aiohttp: #7675') + async def websocket_handler(request): ws = aiohttp.web.WebSocketResponse() await ws.prepare(request)