Skip to content

Commit 45d839a

Browse files
committed
Handle format and mypy
1 parent be6935d commit 45d839a

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

tests/integration/actor_source_base/test_server.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import asyncio
1414
import logging
1515
from collections.abc import Awaitable, Callable, Coroutine
16+
from socket import socket
1617
from typing import Any
1718

1819
from uvicorn import Config
@@ -72,8 +73,10 @@ def url(self) -> URL:
7273
protocol = 'https' if self.config.is_ssl else 'http'
7374
return URL(f'{protocol}://{self.config.host}:{self.config.port}/')
7475

75-
async def serve(self) -> None:
76+
async def serve(self, sockets: list[socket] | None = None) -> None:
7677
"""Run the server."""
78+
if sockets:
79+
raise RuntimeError('Simple TestServer does not support custom sockets')
7780
self.restart_requested = asyncio.Event()
7881

7982
loop = asyncio.get_event_loop()

tests/integration/test_crawlers_with_storages.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
from tests.integration.conftest import MakeActorFunction, RunActorFunction
1+
from __future__ import annotations
2+
3+
from typing import TYPE_CHECKING
4+
5+
if TYPE_CHECKING:
6+
from .conftest import MakeActorFunction, RunActorFunction
27

38

49
async def test_actor_on_platform_max_crawl_depth(
@@ -79,8 +84,7 @@ async def test_actor_on_platform_max_request_retries(
7984

8085
async def main() -> None:
8186
"""The crawler entry point."""
82-
from crawlee._types import BasicCrawlingContext
83-
from crawlee.crawlers import ParselCrawler, ParselCrawlingContext
87+
from crawlee.crawlers import BasicCrawlingContext, ParselCrawler, ParselCrawlingContext
8488

8589
from apify import Actor
8690

@@ -99,7 +103,8 @@ async def default_handler(_: ParselCrawlingContext) -> None:
99103
raise RuntimeError('Some error')
100104

101105
await crawler.run(['http://localhost:8080/'])
102-
assert failed_counter == max_retries, f'{failed_counter=}' # TODO max_retries + 1
106+
# https://github.com/apify/crawlee-python/issues/1326 , should be max_retries + 1
107+
assert failed_counter == max_retries, f'{failed_counter=}'
103108

104109
actor = await make_actor(label='crawler-max-retries', main_func=main)
105110
run_result = await run_actor(actor)

0 commit comments

Comments
 (0)