Skip to content

Commit c479675

Browse files
committed
Install aiohttp 3.9.0b0 on Python 3.12
This partially reverts commit 247fb17.
1 parent 233033b commit c479675

File tree

2 files changed

+18
-11
lines changed

2 files changed

+18
-11
lines changed

setup.py

+2-9
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
# pycodestyle is a dependency of flake8, but it must be frozen because
2929
# their combination breaks too often
3030
# (example breakage: https://gitlab.com/pycqa/flake8/issues/427)
31+
'aiohttp>=3.8.1; python_version < "3.12"',
32+
'aiohttp==3.9.0b0; python_version >= "3.12"',
3133
'flake8~=5.0',
3234
'psutil',
3335
'pycodestyle~=2.9.0',
@@ -36,15 +38,6 @@
3638
CYTHON_DEPENDENCY,
3739
]
3840

39-
if vi < (3, 12):
40-
# XXX Revert this change later.
41-
#
42-
# Python 3.12 is new and there's no aiohttp wheel for it yet.
43-
# And pip helfully fails on building a wheel for it and I've
44-
# no idea how to disable that.
45-
TEST_DEPENDENCIES += ['aiohttp>=3.8.1']
46-
47-
4841
# Dependencies required to build documentation.
4942
DOC_DEPENDENCIES = [
5043
'Sphinx~=4.1.2',

tests/test_aiohttp.py

+16-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
skip_tests = False
88

99
import asyncio
10+
import sys
1011
import unittest
1112
import weakref
1213

@@ -48,6 +49,14 @@ async def test():
4849
self.loop.run_until_complete(runner.cleanup())
4950

5051
def test_aiohttp_graceful_shutdown(self):
52+
if self.implementation == 'asyncio' and sys.version_info >= (3, 12, 0):
53+
# In Python 3.12.0, asyncio.Server.wait_closed() waits for all
54+
# existing connections to complete, before aiohttp sends
55+
# on_shutdown signals.
56+
# https://github.com/aio-libs/aiohttp/issues/7675#issuecomment-1752143748
57+
# https://github.com/python/cpython/pull/98582
58+
raise unittest.SkipTest('bug in aiohttp: #7675')
59+
5160
async def websocket_handler(request):
5261
ws = aiohttp.web.WebSocketResponse()
5362
await ws.prepare(request)
@@ -73,7 +82,12 @@ async def on_shutdown(app):
7382

7483
runner = aiohttp.web.AppRunner(app)
7584
self.loop.run_until_complete(runner.setup())
76-
site = aiohttp.web.TCPSite(runner, '0.0.0.0', '0')
85+
site = aiohttp.web.TCPSite(
86+
runner,
87+
'0.0.0.0',
88+
0,
89+
shutdown_timeout=0.1, # https://github.com/aio-libs/aiohttp/pull/7188
90+
)
7791
self.loop.run_until_complete(site.start())
7892
port = site._server.sockets[0].getsockname()[1]
7993

@@ -90,7 +104,7 @@ async def client():
90104
async def stop():
91105
await asyncio.sleep(0.1)
92106
try:
93-
await asyncio.wait_for(runner.cleanup(), timeout=0.1)
107+
await asyncio.wait_for(runner.cleanup(), timeout=0.5)
94108
finally:
95109
try:
96110
client_task.cancel()

0 commit comments

Comments
 (0)