@@ -56,7 +56,9 @@ async def handler(request):
56
56
assert txt .startswith ("500 Internal Server Error" )
57
57
assert "Traceback" not in txt
58
58
59
- logger .exception .assert_called_with ("Error handling request" , exc_info = exc )
59
+ logger .exception .assert_called_with (
60
+ "Error handling request from %s" , cli .host , exc_info = exc
61
+ )
60
62
61
63
62
64
async def test_raw_server_logs_invalid_method_with_loop_debug (
@@ -85,7 +87,9 @@ async def handler(request: web.BaseRequest) -> NoReturn:
85
87
# on the first request since the client may
86
88
# be probing for TLS/SSL support which is
87
89
# expected to fail
88
- logger .debug .assert_called_with ("Error handling request" , exc_info = exc )
90
+ logger .debug .assert_called_with (
91
+ "Error handling request from %s" , cli .host , exc_info = exc
92
+ )
89
93
logger .debug .reset_mock ()
90
94
91
95
# Now make another connection to the server
@@ -99,7 +103,9 @@ async def handler(request: web.BaseRequest) -> NoReturn:
99
103
# on the first request since the client may
100
104
# be probing for TLS/SSL support which is
101
105
# expected to fail
102
- logger .debug .assert_called_with ("Error handling request" , exc_info = exc )
106
+ logger .debug .assert_called_with (
107
+ "Error handling request from %s" , cli .host , exc_info = exc
108
+ )
103
109
104
110
105
111
async def test_raw_server_logs_invalid_method_without_loop_debug (
@@ -128,7 +134,9 @@ async def handler(request: web.BaseRequest) -> NoReturn:
128
134
# on the first request since the client may
129
135
# be probing for TLS/SSL support which is
130
136
# expected to fail
131
- logger .debug .assert_called_with ("Error handling request" , exc_info = exc )
137
+ logger .debug .assert_called_with (
138
+ "Error handling request from %s" , cli .host , exc_info = exc
139
+ )
132
140
133
141
134
142
async def test_raw_server_logs_invalid_method_second_request (
@@ -159,7 +167,9 @@ async def handler(request: web.BaseRequest) -> web.Response:
159
167
# BadHttpMethod should be logged as an exception
160
168
# if its not the first request since we know
161
169
# that the client already was speaking HTTP
162
- logger .exception .assert_called_with ("Error handling request" , exc_info = exc )
170
+ logger .exception .assert_called_with (
171
+ "Error handling request from %s" , cli .host , exc_info = exc
172
+ )
163
173
164
174
165
175
async def test_raw_server_logs_bad_status_line_as_exception (
@@ -184,7 +194,9 @@ async def handler(request: web.BaseRequest) -> NoReturn:
184
194
txt = await resp .text ()
185
195
assert "Traceback (most recent call last):\n " not in txt
186
196
187
- logger .exception .assert_called_with ("Error handling request" , exc_info = exc )
197
+ logger .exception .assert_called_with (
198
+ "Error handling request from %s" , cli .host , exc_info = exc
199
+ )
188
200
189
201
190
202
async def test_raw_server_handler_timeout (
@@ -254,7 +266,9 @@ async def handler(request):
254
266
txt = await resp .text ()
255
267
assert "Traceback (most recent call last):\n " in txt
256
268
257
- logger .exception .assert_called_with ("Error handling request" , exc_info = exc )
269
+ logger .exception .assert_called_with (
270
+ "Error handling request from %s" , cli .host , exc_info = exc
271
+ )
258
272
259
273
260
274
async def test_raw_server_html_exception (aiohttp_raw_server , aiohttp_client ):
@@ -278,7 +292,9 @@ async def handler(request):
278
292
"</body></html>\n "
279
293
)
280
294
281
- logger .exception .assert_called_with ("Error handling request" , exc_info = exc )
295
+ logger .exception .assert_called_with (
296
+ "Error handling request from %s" , cli .host , exc_info = exc
297
+ )
282
298
283
299
284
300
async def test_raw_server_html_exception_debug (aiohttp_raw_server , aiohttp_client ):
@@ -302,7 +318,9 @@ async def handler(request):
302
318
"<pre>Traceback (most recent call last):\n "
303
319
)
304
320
305
- logger .exception .assert_called_with ("Error handling request" , exc_info = exc )
321
+ logger .exception .assert_called_with (
322
+ "Error handling request from %s" , cli .host , exc_info = exc
323
+ )
306
324
307
325
308
326
async def test_handler_cancellation (unused_port_socket : socket .socket ) -> None :
0 commit comments