File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -31,3 +31,28 @@ async def run_client_benchmark() -> None:
31
31
@benchmark
32
32
def _run () -> None :
33
33
loop .run_until_complete (run_client_benchmark ())
34
+
35
+
36
+ def test_one_hundred_simple_post_requests (
37
+ loop : asyncio .AbstractEventLoop ,
38
+ aiohttp_client : AiohttpClient ,
39
+ benchmark : BenchmarkFixture ,
40
+ ) -> None :
41
+ """Benchmark 100 simple POST requests."""
42
+ message_count = 100
43
+
44
+ async def handler (request : web .Request ) -> web .Response :
45
+ return web .Response ()
46
+
47
+ app = web .Application ()
48
+ app .router .add_route ("POST" , "/" , handler )
49
+
50
+ async def run_client_benchmark () -> None :
51
+ client = await aiohttp_client (app )
52
+ for _ in range (message_count ):
53
+ await client .post ("/" , data = b"any" )
54
+ await client .close ()
55
+
56
+ @benchmark
57
+ def _run () -> None :
58
+ loop .run_until_complete (run_client_benchmark ())
You can’t perform that action at this time.
0 commit comments