Skip to content

Commit 353e821

Browse files
committed
Add test tolerance. It is pytest stoping the test due to MacOS being too slow...
1 parent 1a71ab7 commit 353e821

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

tests/unit/crawlers/_basic/test_basic_crawler.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1294,6 +1294,7 @@ async def test_timeout_in_handler(sleep_type: str, _) -> None:
12941294
max_request_retries = 3
12951295
double_handler_timeout_s = handler_timeout.total_seconds() * 2
12961296
handler_sleep = iter([double_handler_timeout_s, double_handler_timeout_s, 0])
1297+
CI_test_tolerance = 5 # MacOS CI has been slow in exceptional cases
12971298

12981299
crawler = BasicCrawler(
12991300
request_handler_timeout=handler_timeout,
@@ -1322,7 +1323,7 @@ async def handler(context: BasicCrawlingContext) -> None:
13221323

13231324
# Timeout in pytest, because previous implementation would run crawler until following:
13241325
# "The request queue seems to be stuck for 300.0s, resetting internal state."
1325-
async with timeout(max_request_retries * double_handler_timeout_s):
1326+
async with timeout(max_request_retries * double_handler_timeout_s + CI_test_tolerance):
13261327
await crawler.run(['https://a.placeholder.com'])
13271328

13281329
assert crawler.statistics.state.requests_finished == 1

0 commit comments

Comments
 (0)