From 30d3fb15aed457c7a45373e3a920fa9fb5e535e3 Mon Sep 17 00:00:00 2001 From: Vlada Dusek Date: Fri, 9 Jan 2026 10:36:39 +0100 Subject: [PATCH 1/5] test: Fix integration test failures caused by limited permissions Closes: #715 --- tests/integration/actor/conftest.py | 6 +++++- tests/integration/actor/test_actor_api_helpers.py | 10 +++++----- tests/integration/actor/test_actor_scrapy.py | 4 ++-- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/tests/integration/actor/conftest.py b/tests/integration/actor/conftest.py index e7376853..2e7c0c3e 100644 --- a/tests/integration/actor/conftest.py +++ b/tests/integration/actor/conftest.py @@ -13,7 +13,7 @@ from filelock import FileLock from apify_client import ApifyClient, ApifyClientAsync -from apify_shared.consts import ActorJobStatus, ActorSourceType +from apify_shared.consts import ActorJobStatus, ActorPermissionLevel, ActorSourceType from .._utils import generate_unique_resource_name from apify._models import ActorRun @@ -280,12 +280,14 @@ def __call__( *, run_input: Any = None, max_total_charge_usd: Decimal | None = None, + force_permission_level: ActorPermissionLevel | None = None, ) -> Coroutine[None, None, ActorRun]: """Initiate an Actor run and wait for its completion. Args: actor: Actor async client, in testing context usually created by `make_actor` fixture. run_input: Optional input for the Actor run. + force_permission_level: Override the Actor's permissions for this run. Returns: Actor run result. @@ -305,10 +307,12 @@ async def _run_actor( *, run_input: Any = None, max_total_charge_usd: Decimal | None = None, + force_permission_level: ActorPermissionLevel | None = None, ) -> ActorRun: call_result = await actor.call( run_input=run_input, max_total_charge_usd=max_total_charge_usd, + force_permission_level=None if force_permission_level is None else force_permission_level.value, ) assert isinstance(call_result, dict), 'The result of ActorClientAsync.call() is not a dictionary.' diff --git a/tests/integration/actor/test_actor_api_helpers.py b/tests/integration/actor/test_actor_api_helpers.py index 68579fc3..1a18adb7 100644 --- a/tests/integration/actor/test_actor_api_helpers.py +++ b/tests/integration/actor/test_actor_api_helpers.py @@ -4,8 +4,7 @@ import json from typing import TYPE_CHECKING -import pytest - +from apify_shared.consts import ActorPermissionLevel from crawlee._utils.crypto import crypto_random_object_id from .._utils import generate_unique_resource_name @@ -197,7 +196,6 @@ async def main_outer() -> None: assert inner_output_record['value'] == f'{test_value}_XXX_{test_value}' -@pytest.mark.skip(reason='Requires Actor permissions beyond limited permissions, see #715.') async def test_actor_calls_task( make_actor: MakeActorFunction, run_actor: RunActorFunction, @@ -238,6 +236,7 @@ async def main_outer() -> None: run_result_outer = await run_actor( outer_actor, run_input={'test_value': test_value, 'inner_task_id': task['id']}, + force_permission_level=ActorPermissionLevel.FULL_PERMISSIONS, ) assert run_result_outer.status == 'SUCCEEDED' @@ -251,7 +250,6 @@ async def main_outer() -> None: await apify_client_async.task(task['id']).delete() -@pytest.mark.skip(reason='Requires Actor permissions beyond limited permissions, see #715.') async def test_actor_aborts_another_actor_run( make_actor: MakeActorFunction, run_actor: RunActorFunction, @@ -274,11 +272,13 @@ async def main_outer() -> None: inner_actor = await make_actor(label='abort-inner', main_func=main_inner) outer_actor = await make_actor(label='abort-outer', main_func=main_outer) - inner_run_id = (await inner_actor.start())['id'] + run_result_inner = await inner_actor.start(force_permission_level=ActorPermissionLevel.FULL_PERMISSIONS) + inner_run_id = run_result_inner['id'] run_result_outer = await run_actor( outer_actor, run_input={'inner_run_id': inner_run_id}, + force_permission_level=ActorPermissionLevel.FULL_PERMISSIONS, ) assert run_result_outer.status == 'SUCCEEDED' diff --git a/tests/integration/actor/test_actor_scrapy.py b/tests/integration/actor/test_actor_scrapy.py index 1fda27d1..b4dd5fee 100644 --- a/tests/integration/actor/test_actor_scrapy.py +++ b/tests/integration/actor/test_actor_scrapy.py @@ -3,13 +3,12 @@ from pathlib import Path from typing import TYPE_CHECKING -import pytest +from apify_shared.consts import ActorPermissionLevel if TYPE_CHECKING: from .conftest import MakeActorFunction, RunActorFunction -@pytest.mark.skip(reason='Requires Actor permissions beyond limited permissions, see #715.') async def test_actor_scrapy_title_spider( make_actor: MakeActorFunction, run_actor: RunActorFunction, @@ -38,6 +37,7 @@ async def test_actor_scrapy_title_spider( 'allowedDomains': ['crawlee.dev'], 'proxyConfiguration': {'useApifyProxy': True}, }, + force_permission_level=ActorPermissionLevel.FULL_PERMISSIONS, ) assert run_result.status == 'SUCCEEDED' From bcbc5679486f20502919f6f535dccc03eb62b3a9 Mon Sep 17 00:00:00 2001 From: Vlada Dusek Date: Fri, 9 Jan 2026 10:48:03 +0100 Subject: [PATCH 2/5] Test it with client 2.3.1b22 --- pyproject.toml | 2 +- uv.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 265b7e73..60d66b11 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -35,7 +35,7 @@ keywords = [ "scraping", ] dependencies = [ - "apify-client>=2.3.0,<3.0.0", + "apify-client==2.3.1b22", "apify-shared>=2.0.0,<3.0.0", "crawlee>=1.0.4,<2.0.0", "cachetools>=5.5.0", diff --git a/uv.lock b/uv.lock index 602929ff..46bfb417 100644 --- a/uv.lock +++ b/uv.lock @@ -72,7 +72,7 @@ dev = [ [package.metadata] requires-dist = [ - { name = "apify-client", specifier = ">=2.3.0,<3.0.0" }, + { name = "apify-client", specifier = "==2.3.1b22" }, { name = "apify-shared", specifier = ">=2.0.0,<3.0.0" }, { name = "cachetools", specifier = ">=5.5.0" }, { name = "crawlee", specifier = ">=1.0.4,<2.0.0" }, @@ -111,7 +111,7 @@ dev = [ [[package]] name = "apify-client" -version = "2.3.0" +version = "2.3.1b22" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "apify-shared" }, @@ -119,9 +119,9 @@ dependencies = [ { name = "impit" }, { name = "more-itertools" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/dd/e3/08c1eb269d4559e5c01343347c913423c24efd425f0c2bd9f743e28c8a86/apify_client-2.3.0.tar.gz", hash = "sha256:ff6d32e27d5205343e89057ac0e0c02b53a9219ccedfd30a3c4d70d13d931488", size = 389101, upload-time = "2025-11-13T13:42:33.923Z" } +sdist = { url = "https://files.pythonhosted.org/packages/b9/a4/41367afaa06d04190870c91d551b0abe08679244b8fb81b2fa0e0b4544e2/apify_client-2.3.1b22.tar.gz", hash = "sha256:a90ec1a568114b360a9cb2fa19ed1660f47f8c219651e1a9920e4d43e39dad15", size = 368714, upload-time = "2026-01-09T09:44:21.42Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/26/b6/6dabe41804932e020557450abc8bc74725a942c6f08969021efe965d4260/apify_client-2.3.0-py3-none-any.whl", hash = "sha256:6ae9b1461c2a15ab19c6131bfcab55be9362259cced9b254b827b4c3b6c12d40", size = 85996, upload-time = "2025-11-13T13:42:32.012Z" }, + { url = "https://files.pythonhosted.org/packages/02/b7/db251db44cb2743048e13460838c5abb4f463608ec32ca4964bba01b505a/apify_client-2.3.1b22-py3-none-any.whl", hash = "sha256:afe2f213694681f5d14082d6f7650903a8cf17b0b9ca1c3c3635508aac843c0b", size = 86187, upload-time = "2026-01-09T09:44:20.284Z" }, ] [[package]] From 767dfaf71c2662b6fa8a72cdc3bdab602e9329c3 Mon Sep 17 00:00:00 2001 From: Vlada Dusek Date: Fri, 9 Jan 2026 11:11:38 +0100 Subject: [PATCH 3/5] Fix --- tests/integration/actor/conftest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integration/actor/conftest.py b/tests/integration/actor/conftest.py index 2e7c0c3e..cba40178 100644 --- a/tests/integration/actor/conftest.py +++ b/tests/integration/actor/conftest.py @@ -312,7 +312,7 @@ async def _run_actor( call_result = await actor.call( run_input=run_input, max_total_charge_usd=max_total_charge_usd, - force_permission_level=None if force_permission_level is None else force_permission_level.value, + force_permission_level=force_permission_level, ) assert isinstance(call_result, dict), 'The result of ActorClientAsync.call() is not a dictionary.' From 943b812624fa8b4767f8ea9ac8294554c7c1ec0d Mon Sep 17 00:00:00 2001 From: Vlada Dusek Date: Fri, 9 Jan 2026 12:16:36 +0100 Subject: [PATCH 4/5] versions --- pyproject.toml | 2 +- uv.lock | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 60d66b11..265b7e73 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -35,7 +35,7 @@ keywords = [ "scraping", ] dependencies = [ - "apify-client==2.3.1b22", + "apify-client>=2.3.0,<3.0.0", "apify-shared>=2.0.0,<3.0.0", "crawlee>=1.0.4,<2.0.0", "cachetools>=5.5.0", diff --git a/uv.lock b/uv.lock index 46bfb417..4e2202c9 100644 --- a/uv.lock +++ b/uv.lock @@ -72,7 +72,7 @@ dev = [ [package.metadata] requires-dist = [ - { name = "apify-client", specifier = "==2.3.1b22" }, + { name = "apify-client", specifier = ">=2.3.0,<3.0.0" }, { name = "apify-shared", specifier = ">=2.0.0,<3.0.0" }, { name = "cachetools", specifier = ">=5.5.0" }, { name = "crawlee", specifier = ">=1.0.4,<2.0.0" }, From 3586715a55bf2167ef0f8a69ad3e9faaf8221516 Mon Sep 17 00:00:00 2001 From: Vlada Dusek Date: Fri, 9 Jan 2026 12:17:57 +0100 Subject: [PATCH 5/5] versions --- uv.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/uv.lock b/uv.lock index 4e2202c9..a313e610 100644 --- a/uv.lock +++ b/uv.lock @@ -111,7 +111,7 @@ dev = [ [[package]] name = "apify-client" -version = "2.3.1b22" +version = "2.4.0" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "apify-shared" }, @@ -119,9 +119,9 @@ dependencies = [ { name = "impit" }, { name = "more-itertools" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/b9/a4/41367afaa06d04190870c91d551b0abe08679244b8fb81b2fa0e0b4544e2/apify_client-2.3.1b22.tar.gz", hash = "sha256:a90ec1a568114b360a9cb2fa19ed1660f47f8c219651e1a9920e4d43e39dad15", size = 368714, upload-time = "2026-01-09T09:44:21.42Z" } +sdist = { url = "https://files.pythonhosted.org/packages/24/6a/82e2d61641508e2a8a0509e78d1641273df901683e7108afc71b078c8488/apify_client-2.4.0.tar.gz", hash = "sha256:efcad708f9091f774f180ced18e2aaaec3b45effcc19b933d2fa0b3059b8a001", size = 368665, upload-time = "2026-01-09T10:33:25.756Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/02/b7/db251db44cb2743048e13460838c5abb4f463608ec32ca4964bba01b505a/apify_client-2.3.1b22-py3-none-any.whl", hash = "sha256:afe2f213694681f5d14082d6f7650903a8cf17b0b9ca1c3c3635508aac843c0b", size = 86187, upload-time = "2026-01-09T09:44:20.284Z" }, + { url = "https://files.pythonhosted.org/packages/3b/65/71dd2515b799bded5a767006423a11ebac27f41193372e751672f4c12516/apify_client-2.4.0-py3-none-any.whl", hash = "sha256:073109fa136fd978471eff62bf30eda9a51557a5ee383fe762c89430cee27c30", size = 86156, upload-time = "2026-01-09T10:33:24.524Z" }, ] [[package]]