@@ -133,16 +133,14 @@ async def test_handles_redirects(
133
133
@pytest .mark .parametrize (
134
134
('additional_http_error_status_codes' , 'ignore_http_error_status_codes' , 'expected_number_error' ),
135
135
[
136
- ([], [], 1 ),
137
- ([403 ], [], 3 ),
138
- ([], [403 ], 0 ),
139
- ([403 ], [403 ], 3 ),
140
- ],
141
- ids = [
142
- 'default_behavior' , # error without retry for all 4xx statuses
143
- 'additional_status_codes' , # make retry for codes in `additional_http_error_status_codes` list
144
- 'ignore_error_status_codes' , # take as successful status codes from the `ignore_http_error_status_codes` list
145
- 'additional_and_ignore' , # check precedence for `additional_http_error_status_codes`
136
+ # error without retry for all 4xx statuses
137
+ pytest .param ([], [], 1 , id = 'default_behavior' ),
138
+ # make retry for codes in `additional_http_error_status_codes` list
139
+ pytest .param ([403 ], [], 3 , id = 'additional_status_codes' ),
140
+ # take as successful status codes from the `ignore_http_error_status_codes` list
141
+ pytest .param ([], [403 ], 0 , id = 'ignore_error_status_codes' ),
142
+ # check precedence for `additional_http_error_status_codes`
143
+ pytest .param ([403 ], [403 ], 3 , id = 'additional_and_ignore' ),
146
144
],
147
145
)
148
146
async def test_handles_client_errors (
@@ -258,9 +256,7 @@ async def test_http_status_statistics(crawler: HttpCrawler, server: respx.MockRo
258
256
259
257
260
258
@pytest .mark .parametrize (
261
- 'http_client_class' ,
262
- [CurlImpersonateHttpClient , HttpxHttpClient ],
263
- ids = ['curl' , 'httpx' ],
259
+ 'http_client_class' , [pytest .param (CurlImpersonateHttpClient , id = 'curl' ), pytest .param (HttpxHttpClient , id = 'httpx' )]
264
260
)
265
261
async def test_sending_payload_as_raw_data (http_client_class : type [BaseHttpClient ], httpbin : URL ) -> None :
266
262
http_client = http_client_class ()
@@ -295,9 +291,7 @@ async def request_handler(context: HttpCrawlingContext) -> None:
295
291
296
292
297
293
@pytest .mark .parametrize (
298
- 'http_client_class' ,
299
- [CurlImpersonateHttpClient , HttpxHttpClient ],
300
- ids = ['curl' , 'httpx' ],
294
+ 'http_client_class' , [pytest .param (CurlImpersonateHttpClient , id = 'curl' ), pytest .param (HttpxHttpClient , id = 'httpx' )]
301
295
)
302
296
async def test_sending_payload_as_form_data (http_client_class : type [BaseHttpClient ], httpbin : URL ) -> None :
303
297
http_client = http_client_class ()
@@ -327,9 +321,7 @@ async def request_handler(context: HttpCrawlingContext) -> None:
327
321
328
322
329
323
@pytest .mark .parametrize (
330
- 'http_client_class' ,
331
- [CurlImpersonateHttpClient , HttpxHttpClient ],
332
- ids = ['curl' , 'httpx' ],
324
+ 'http_client_class' , [pytest .param (CurlImpersonateHttpClient , id = 'curl' ), pytest .param (HttpxHttpClient , id = 'httpx' )]
333
325
)
334
326
async def test_sending_payload_as_json (http_client_class : type [BaseHttpClient ], httpbin : URL ) -> None :
335
327
http_client = http_client_class ()
@@ -360,9 +352,7 @@ async def request_handler(context: HttpCrawlingContext) -> None:
360
352
361
353
362
354
@pytest .mark .parametrize (
363
- 'http_client_class' ,
364
- [CurlImpersonateHttpClient , HttpxHttpClient ],
365
- ids = ['curl' , 'httpx' ],
355
+ 'http_client_class' , [pytest .param (CurlImpersonateHttpClient , id = 'curl' ), pytest .param (HttpxHttpClient , id = 'httpx' )]
366
356
)
367
357
async def test_sending_url_query_params (http_client_class : type [BaseHttpClient ], httpbin : URL ) -> None :
368
358
http_client = http_client_class ()
@@ -435,8 +425,14 @@ async def test_isolation_cookies(http_client_class: type[BaseHttpClient], httpbi
435
425
response_cookies : dict [str , dict [str , str ]] = {}
436
426
437
427
crawler = HttpCrawler (
438
- session_pool = SessionPool (max_pool_size = 1 ),
428
+ session_pool = SessionPool (
429
+ max_pool_size = 1 ,
430
+ create_session_settings = {
431
+ 'max_error_score' : 50 ,
432
+ },
433
+ ),
439
434
http_client = http_client ,
435
+ max_request_retries = 10 ,
440
436
concurrency_settings = ConcurrencySettings (max_concurrency = 1 ),
441
437
)
442
438
0 commit comments