Skip to content

Commit a47887a

Browse files
committed
Update test to included statistics before reboot.
Temporarily point to unmerged crawlee version that contains the fix.
1 parent af01e50 commit a47887a

4 files changed

Lines changed: 9 additions & 11 deletions

File tree

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ keywords = [
3636
dependencies = [
3737
"apify-client>=2.0.0,<3.0.0",
3838
"apify-shared>=2.0.0,<3.0.0",
39-
"crawlee>=1.0.2,<2.0.0",
39+
"crawlee @ git+https://github.com/apify/crawlee-python@crawler-persistance",
4040
"cachetools>=5.5.0",
4141
"cryptography>=42.0.0",
4242
"impit>=0.6.1",
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# The test fixture will put the Apify SDK wheel path on the next line
22
APIFY_SDK_WHEEL_PLACEHOLDER
33
uvicorn[standard]
4-
crawlee[parsel]>=1.0.0,<2.0.0
4+
crawlee[parsel] @ git+https://github.com/apify/crawlee-python@crawler-persistance

tests/integration/test_actor_lifecycle.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,8 @@ async def main() -> None:
122122
async def test_actor_with_crawler_reboot(make_actor: MakeActorFunction, run_actor: RunActorFunction) -> None:
123123
"""Test that crawler in actor works as expected after reboot.
124124
125-
Handle two requests. Reboot in between the two requests."""
125+
Handle two requests. Reboot in between the two requests. The second run should include statistics of the fist run.
126+
"""
126127

127128
async def main() -> None:
128129
from crawlee._types import BasicCrawlingContext, ConcurrencySettings
@@ -152,7 +153,8 @@ async def default_handler(context: BasicCrawlingContext) -> None:
152153
await crawler.run(requests)
153154

154155
# Each time one request is finished.
155-
assert crawler.statistics.state.requests_finished == 1
156+
expected_requests_finished = 1 if first_run else 2
157+
assert crawler.statistics.state.requests_finished == expected_requests_finished
156158

157159
actor = await make_actor(label='migration', main_func=main)
158160
run_result = await run_actor(actor)

uv.lock

Lines changed: 3 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)