File tree Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -200,6 +200,9 @@ async def init(self) -> None:
200
200
if self ._is_initialized :
201
201
raise RuntimeError ('The Actor was already initialized!' )
202
202
203
+ # Make sure that the currently initialized instance is also available through the global `Actor` proxy
204
+ cast (Proxy , Actor ).__wrapped__ = self
205
+
203
206
self ._is_exiting = False
204
207
self ._was_final_persist_state_emitted = False
205
208
Original file line number Diff line number Diff line change 16
16
import apify ._actor
17
17
from apify import Actor
18
18
from apify ._actor import _ActorType
19
+ from apify ._configuration import Configuration
19
20
20
21
21
22
async def test_actor_properly_init_with_async () -> None :
@@ -35,6 +36,13 @@ async def test_actor_init() -> None:
35
36
assert my_actor ._is_initialized is False
36
37
37
38
39
+ async def test_actor_global_works () -> None :
40
+ non_default_configuration = Configuration (actor_full_name = 'Actor McActorson, esq.' )
41
+
42
+ async with Actor (configuration = non_default_configuration ):
43
+ assert Actor .configuration is non_default_configuration
44
+
45
+
38
46
async def test_double_init_raises_error (prepare_test_env : Callable ) -> None :
39
47
async with Actor :
40
48
assert Actor ._is_initialized
You can’t perform that action at this time.
0 commit comments