Skip to content

Commit 37e54a2

Browse files
committed
Merge branch 'windows' of https://github.com/Vizonex/uvloop into windows
2 parents 9bd6dd6 + d8eac6a commit 37e54a2

25 files changed

+639
-316
lines changed

.github/workflows/tests.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
name: Tests
22

33
on:
4-
# TODO: (Vizonex) Remove later I'm just a little impaitient...
5-
workflow_dispatch:
64
push:
75
branches:
86
- master
97
- ci
108
pull_request:
119
branches:
10+
- windows
1211
- master
1312

1413
jobs:

setup.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,6 @@ def build_extensions(self):
266266
"vendor/libuv/src/win",
267267
"vendor/libuv/include",
268268
],
269-
extra_compile_args=["/std:c11", "/experimental:c11atomics"],
270269
# subset of libuv Windows libraries:
271270
extra_link_args=[
272271
(f"-l{lib}" if MINGW else f"{lib}.lib")

tests/__main__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ def suite():
1010
return test_suite
1111

1212

13-
if __name__ == '__main__':
13+
if __name__ == "__main__":
1414
runner = unittest.runner.TextTestRunner()
1515
result = runner.run(suite())
1616
sys.exit(not result.wasSuccessful())

tests/test_aiohttp.py

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,29 +18,28 @@ class _TestAioHTTP:
1818

1919
def test_aiohttp_basic_1(self):
2020

21-
PAYLOAD = '<h1>It Works!</h1>' * 10000
21+
PAYLOAD = "<h1>It Works!</h1>" * 10000
2222

2323
async def on_request(request):
2424
return aiohttp.web.Response(text=PAYLOAD)
2525

2626
asyncio.set_event_loop(self.loop)
2727
app = aiohttp.web.Application()
28-
app.router.add_get('/', on_request)
28+
app.router.add_get("/", on_request)
2929

3030
runner = aiohttp.web.AppRunner(app)
3131
self.loop.run_until_complete(runner.setup())
32-
site = aiohttp.web.TCPSite(runner, '0.0.0.0', '0')
32+
site = aiohttp.web.TCPSite(runner, "0.0.0.0", "0")
3333
self.loop.run_until_complete(site.start())
3434
port = site._server.sockets[0].getsockname()[1]
3535

3636
async def test():
3737
# Make sure we're using the correct event loop.
3838
self.assertIs(asyncio.get_event_loop(), self.loop)
3939

40-
for addr in (('localhost', port),
41-
('127.0.0.1', port)):
40+
for addr in (("localhost", port), ("127.0.0.1", port)):
4241
async with aiohttp.ClientSession() as client:
43-
async with client.get('http://{}:{}'.format(*addr)) as r:
42+
async with client.get("http://{}:{}".format(*addr)) as r:
4443
self.assertEqual(r.status, 200)
4544
result = await r.text()
4645
self.assertEqual(result, PAYLOAD)
@@ -49,42 +48,43 @@ async def test():
4948
self.loop.run_until_complete(runner.cleanup())
5049

5150
def test_aiohttp_graceful_shutdown(self):
52-
if self.implementation == 'asyncio' and sys.version_info >= (3, 12, 0):
51+
if self.implementation == "asyncio" and sys.version_info >= (3, 12, 0):
5352
# In Python 3.12.0, asyncio.Server.wait_closed() waits for all
5453
# existing connections to complete, before aiohttp sends
5554
# on_shutdown signals.
5655
# https://github.com/aio-libs/aiohttp/issues/7675#issuecomment-1752143748
5756
# https://github.com/python/cpython/pull/98582
58-
raise unittest.SkipTest('bug in aiohttp: #7675')
57+
raise unittest.SkipTest("bug in aiohttp: #7675")
5958

6059
async def websocket_handler(request):
6160
ws = aiohttp.web.WebSocketResponse()
6261
await ws.prepare(request)
63-
request.app['websockets'].add(ws)
62+
request.app["websockets"].add(ws)
6463
try:
6564
async for msg in ws:
6665
await ws.send_str(msg.data)
6766
finally:
68-
request.app['websockets'].discard(ws)
67+
request.app["websockets"].discard(ws)
6968
return ws
7069

7170
async def on_shutdown(app):
72-
for ws in set(app['websockets']):
71+
for ws in set(app["websockets"]):
7372
await ws.close(
7473
code=aiohttp.WSCloseCode.GOING_AWAY,
75-
message='Server shutdown')
74+
message="Server shutdown",
75+
)
7676

7777
asyncio.set_event_loop(self.loop)
7878
app = aiohttp.web.Application()
79-
app.router.add_get('/', websocket_handler)
79+
app.router.add_get("/", websocket_handler)
8080
app.on_shutdown.append(on_shutdown)
81-
app['websockets'] = weakref.WeakSet()
81+
app["websockets"] = weakref.WeakSet()
8282

8383
runner = aiohttp.web.AppRunner(app)
8484
self.loop.run_until_complete(runner.setup())
8585
site = aiohttp.web.TCPSite(
8686
runner,
87-
'0.0.0.0',
87+
"0.0.0.0",
8888
0,
8989
# https://github.com/aio-libs/aiohttp/pull/7188
9090
shutdown_timeout=0.1,
@@ -95,7 +95,8 @@ async def on_shutdown(app):
9595
async def client():
9696
async with aiohttp.ClientSession() as client:
9797
async with client.ws_connect(
98-
'http://127.0.0.1:{}'.format(port)) as ws:
98+
"http://127.0.0.1:{}".format(port)
99+
) as ws:
99100
await ws.send_str("hello")
100101
async for msg in ws:
101102
assert msg.data == "hello"

0 commit comments

Comments
 (0)