Skip to content

Commit 5a77d48

Browse files
committed
Fix linting
1 parent 65e18a8 commit 5a77d48

File tree

2 files changed

+152
-104
lines changed

2 files changed

+152
-104
lines changed

tests/_async/test_connection_pool.py

Lines changed: 76 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -185,58 +185,82 @@ async def test_debug_request(caplog):
185185
async with AsyncConnectionPool(network_backend=network_backend) as pool:
186186
await pool.request("GET", "http://example.com/")
187187

188-
assert caplog.record_tuples == [('httpcore.connection_pool',
189-
10,
190-
"create_connection.started origin='http://example.com:80'"),
191-
('httpcore.connection_pool',
192-
10,
193-
'create_connection.complete return_value=<AsyncHTTPConnection [CONNECTING]>'),
194-
('httpcore.connection_pool',
195-
10,
196-
'set_connection.started connection=<AsyncHTTPConnection [CONNECTING]>'),
197-
('httpcore.connection_pool', 10, 'set_connection.complete'),
198-
('httpcore.connection_pool', 10, 'Waiting for a connection.'),
199-
('httpcore.connection_pool',
200-
10,
201-
'The ConnectionPool currently has 1 request(s) awaiting connections.'),
202-
('httpcore.connection_pool', 10, 'Connection received.'),
203-
('httpcore.connection_pool',
204-
10,
205-
'The ConnectionPool currently has 0 request(s) awaiting connections.'),
206-
('httpcore.connection',
207-
10,
208-
"connect_tcp.started host='example.com' port=80 local_address=None "
209-
'timeout=None socket_options=None'),
210-
('httpcore.connection',
211-
10,
212-
'connect_tcp.complete return_value=<httpcore.AsyncMockStream>'),
213-
('httpcore.http11',
214-
10,
215-
"send_request_headers.started request=<Request [b'GET']>"),
216-
('httpcore.http11', 10, 'send_request_headers.complete'),
217-
('httpcore.http11',
218-
10,
219-
"send_request_body.started request=<Request [b'GET']>"),
220-
('httpcore.http11', 10, 'send_request_body.complete'),
221-
('httpcore.http11',
222-
10,
223-
"receive_response_headers.started request=<Request [b'GET']>"),
224-
('httpcore.http11',
225-
10,
226-
"receive_response_headers.complete return_value=(b'HTTP/1.1', 200, b'OK', "
227-
"[(b'Content-Type', b'plain/text'), (b'Content-Length', b'13')])"),
228-
('httpcore.http11',
229-
10,
230-
"receive_response_body.started request=<Request [b'GET']>"),
231-
('httpcore.http11', 10, 'receive_response_body.complete'),
232-
('httpcore.http11', 10, 'response_closed.started'),
233-
('httpcore.http11', 10, 'response_closed.complete'),
234-
('httpcore.connection_pool',
235-
10,
236-
"Connection: <AsyncHTTPConnection ['http://example.com:80', HTTP/1.1, IDLE, "
237-
'Request Count: 1]> was returned into the pool'),
238-
('httpcore.connection', 10, 'close.started'),
239-
('httpcore.connection', 10, 'close.complete')]
188+
assert caplog.record_tuples == [
189+
(
190+
"httpcore.connection_pool",
191+
10,
192+
"create_connection.started origin='http://example.com:80'",
193+
),
194+
(
195+
"httpcore.connection_pool",
196+
10,
197+
"create_connection.complete return_value=<AsyncHTTPConnection [CONNECTING]>",
198+
),
199+
(
200+
"httpcore.connection_pool",
201+
10,
202+
"set_connection.started connection=<AsyncHTTPConnection [CONNECTING]>",
203+
),
204+
("httpcore.connection_pool", 10, "set_connection.complete"),
205+
("httpcore.connection_pool", 10, "Waiting for a connection."),
206+
(
207+
"httpcore.connection_pool",
208+
10,
209+
"The ConnectionPool currently has 1 request(s) awaiting connections.",
210+
),
211+
("httpcore.connection_pool", 10, "Connection received."),
212+
(
213+
"httpcore.connection_pool",
214+
10,
215+
"The ConnectionPool currently has 0 request(s) awaiting connections.",
216+
),
217+
(
218+
"httpcore.connection",
219+
10,
220+
"connect_tcp.started host='example.com' port=80 local_address=None "
221+
"timeout=None socket_options=None",
222+
),
223+
(
224+
"httpcore.connection",
225+
10,
226+
"connect_tcp.complete return_value=<httpcore.AsyncMockStream>",
227+
),
228+
(
229+
"httpcore.http11",
230+
10,
231+
"send_request_headers.started request=<Request [b'GET']>",
232+
),
233+
("httpcore.http11", 10, "send_request_headers.complete"),
234+
("httpcore.http11", 10, "send_request_body.started request=<Request [b'GET']>"),
235+
("httpcore.http11", 10, "send_request_body.complete"),
236+
(
237+
"httpcore.http11",
238+
10,
239+
"receive_response_headers.started request=<Request [b'GET']>",
240+
),
241+
(
242+
"httpcore.http11",
243+
10,
244+
"receive_response_headers.complete return_value=(b'HTTP/1.1', 200, b'OK', "
245+
"[(b'Content-Type', b'plain/text'), (b'Content-Length', b'13')])",
246+
),
247+
(
248+
"httpcore.http11",
249+
10,
250+
"receive_response_body.started request=<Request [b'GET']>",
251+
),
252+
("httpcore.http11", 10, "receive_response_body.complete"),
253+
("httpcore.http11", 10, "response_closed.started"),
254+
("httpcore.http11", 10, "response_closed.complete"),
255+
(
256+
"httpcore.connection_pool",
257+
10,
258+
"Connection: <AsyncHTTPConnection ['http://example.com:80', HTTP/1.1, IDLE, "
259+
"Request Count: 1]> was returned into the pool",
260+
),
261+
("httpcore.connection", 10, "close.started"),
262+
("httpcore.connection", 10, "close.complete"),
263+
]
240264

241265

242266
@pytest.mark.anyio

tests/_sync/test_connection_pool.py

Lines changed: 76 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -185,58 +185,82 @@ def test_debug_request(caplog):
185185
with ConnectionPool(network_backend=network_backend) as pool:
186186
pool.request("GET", "http://example.com/")
187187

188-
assert caplog.record_tuples == [('httpcore.connection_pool',
189-
10,
190-
"create_connection.started origin='http://example.com:80'"),
191-
('httpcore.connection_pool',
192-
10,
193-
'create_connection.complete return_value=<HTTPConnection [CONNECTING]>'),
194-
('httpcore.connection_pool',
195-
10,
196-
'set_connection.started connection=<HTTPConnection [CONNECTING]>'),
197-
('httpcore.connection_pool', 10, 'set_connection.complete'),
198-
('httpcore.connection_pool', 10, 'Waiting for a connection.'),
199-
('httpcore.connection_pool',
200-
10,
201-
'The ConnectionPool currently has 1 request(s) awaiting connections.'),
202-
('httpcore.connection_pool', 10, 'Connection received.'),
203-
('httpcore.connection_pool',
204-
10,
205-
'The ConnectionPool currently has 0 request(s) awaiting connections.'),
206-
('httpcore.connection',
207-
10,
208-
"connect_tcp.started host='example.com' port=80 local_address=None "
209-
'timeout=None socket_options=None'),
210-
('httpcore.connection',
211-
10,
212-
'connect_tcp.complete return_value=<httpcore.MockStream>'),
213-
('httpcore.http11',
214-
10,
215-
"send_request_headers.started request=<Request [b'GET']>"),
216-
('httpcore.http11', 10, 'send_request_headers.complete'),
217-
('httpcore.http11',
218-
10,
219-
"send_request_body.started request=<Request [b'GET']>"),
220-
('httpcore.http11', 10, 'send_request_body.complete'),
221-
('httpcore.http11',
222-
10,
223-
"receive_response_headers.started request=<Request [b'GET']>"),
224-
('httpcore.http11',
225-
10,
226-
"receive_response_headers.complete return_value=(b'HTTP/1.1', 200, b'OK', "
227-
"[(b'Content-Type', b'plain/text'), (b'Content-Length', b'13')])"),
228-
('httpcore.http11',
229-
10,
230-
"receive_response_body.started request=<Request [b'GET']>"),
231-
('httpcore.http11', 10, 'receive_response_body.complete'),
232-
('httpcore.http11', 10, 'response_closed.started'),
233-
('httpcore.http11', 10, 'response_closed.complete'),
234-
('httpcore.connection_pool',
235-
10,
236-
"Connection: <HTTPConnection ['http://example.com:80', HTTP/1.1, IDLE, "
237-
'Request Count: 1]> was returned into the pool'),
238-
('httpcore.connection', 10, 'close.started'),
239-
('httpcore.connection', 10, 'close.complete')]
188+
assert caplog.record_tuples == [
189+
(
190+
"httpcore.connection_pool",
191+
10,
192+
"create_connection.started origin='http://example.com:80'",
193+
),
194+
(
195+
"httpcore.connection_pool",
196+
10,
197+
"create_connection.complete return_value=<HTTPConnection [CONNECTING]>",
198+
),
199+
(
200+
"httpcore.connection_pool",
201+
10,
202+
"set_connection.started connection=<HTTPConnection [CONNECTING]>",
203+
),
204+
("httpcore.connection_pool", 10, "set_connection.complete"),
205+
("httpcore.connection_pool", 10, "Waiting for a connection."),
206+
(
207+
"httpcore.connection_pool",
208+
10,
209+
"The ConnectionPool currently has 1 request(s) awaiting connections.",
210+
),
211+
("httpcore.connection_pool", 10, "Connection received."),
212+
(
213+
"httpcore.connection_pool",
214+
10,
215+
"The ConnectionPool currently has 0 request(s) awaiting connections.",
216+
),
217+
(
218+
"httpcore.connection",
219+
10,
220+
"connect_tcp.started host='example.com' port=80 local_address=None "
221+
"timeout=None socket_options=None",
222+
),
223+
(
224+
"httpcore.connection",
225+
10,
226+
"connect_tcp.complete return_value=<httpcore.MockStream>",
227+
),
228+
(
229+
"httpcore.http11",
230+
10,
231+
"send_request_headers.started request=<Request [b'GET']>",
232+
),
233+
("httpcore.http11", 10, "send_request_headers.complete"),
234+
("httpcore.http11", 10, "send_request_body.started request=<Request [b'GET']>"),
235+
("httpcore.http11", 10, "send_request_body.complete"),
236+
(
237+
"httpcore.http11",
238+
10,
239+
"receive_response_headers.started request=<Request [b'GET']>",
240+
),
241+
(
242+
"httpcore.http11",
243+
10,
244+
"receive_response_headers.complete return_value=(b'HTTP/1.1', 200, b'OK', "
245+
"[(b'Content-Type', b'plain/text'), (b'Content-Length', b'13')])",
246+
),
247+
(
248+
"httpcore.http11",
249+
10,
250+
"receive_response_body.started request=<Request [b'GET']>",
251+
),
252+
("httpcore.http11", 10, "receive_response_body.complete"),
253+
("httpcore.http11", 10, "response_closed.started"),
254+
("httpcore.http11", 10, "response_closed.complete"),
255+
(
256+
"httpcore.connection_pool",
257+
10,
258+
"Connection: <HTTPConnection ['http://example.com:80', HTTP/1.1, IDLE, "
259+
"Request Count: 1]> was returned into the pool",
260+
),
261+
("httpcore.connection", 10, "close.started"),
262+
("httpcore.connection", 10, "close.complete"),
263+
]
240264

241265

242266

0 commit comments

Comments
 (0)