@@ -25,14 +25,14 @@ async def main() -> None:
25
25
26
26
actor = await make_actor ('is-at-home' , main_func = main )
27
27
28
- run_result = await actor .call ()
29
- assert run_result is not None
28
+ call_result = await actor .call ()
29
+ assert call_result is not None
30
30
31
- run_client = apify_client_async .run (run_result ['id' ])
32
- run_client_result = await run_client .wait_for_finish (wait_secs = 300 )
31
+ run_client = apify_client_async .run (call_result ['id' ])
32
+ run_result = await run_client .wait_for_finish (wait_secs = 300 )
33
33
34
- assert run_client_result is not None
35
- assert run_client_result ['status' ] == 'SUCCEEDED'
34
+ assert run_result is not None
35
+ assert run_result ['status' ] == 'SUCCEEDED'
36
36
37
37
38
38
async def test_actor_retrieves_env_vars (
@@ -57,13 +57,13 @@ async def main() -> None:
57
57
58
58
actor = await make_actor ('get-env' , main_func = main )
59
59
60
- run_result = await actor .call ()
61
- assert run_result is not None
60
+ call_result = await actor .call ()
61
+ assert call_result is not None
62
62
63
- run_client = apify_client_async .run (run_result ['id' ])
64
- run_client_result = await run_client .wait_for_finish (wait_secs = 300 )
63
+ run_client = apify_client_async .run (call_result ['id' ])
64
+ run_result = await run_client .wait_for_finish (wait_secs = 300 )
65
65
66
- assert run_client_result is not None
66
+ assert run_result is not None
67
67
assert run_result ['status' ] == 'SUCCEEDED'
68
68
69
69
@@ -87,44 +87,58 @@ async def main() -> None:
87
87
88
88
actor = await make_actor ('new-client' , main_func = main )
89
89
90
- run_result = await actor .call ()
91
- assert run_result is not None
90
+ call_result = await actor .call ()
91
+ assert call_result is not None
92
92
93
- run_client = apify_client_async .run (run_result ['id' ])
94
- run_client_result = await run_client .wait_for_finish (wait_secs = 300 )
93
+ run_client = apify_client_async .run (call_result ['id' ])
94
+ run_result = await run_client .wait_for_finish (wait_secs = 300 )
95
95
96
- assert run_client_result is not None
96
+ assert run_result is not None
97
97
assert run_result ['status' ] == 'SUCCEEDED'
98
98
99
99
output_record = await actor .last_run ().key_value_store ().get_record ('OUTPUT' )
100
100
assert output_record is not None
101
101
assert output_record ['value' ] == 'TESTING-OUTPUT'
102
102
103
103
104
- async def test_actor_sets_status_message (make_actor : ActorFactory ) -> None :
104
+ async def test_actor_sets_status_message (
105
+ apify_client_async : ApifyClientAsync ,
106
+ make_actor : ActorFactory ,
107
+ ) -> None :
105
108
async def main () -> None :
106
109
async with Actor :
107
110
actor_input = await Actor .get_input () or {}
108
111
await Actor .set_status_message ('testing-status-message' , ** actor_input )
109
112
110
113
actor = await make_actor ('set-status-message' , main_func = main )
111
114
112
- run_result = await actor .call ()
115
+ call_result = await actor .call ()
116
+ assert call_result is not None
117
+
118
+ run_client = apify_client_async .run (call_result ['id' ])
119
+ run_result = await run_client .wait_for_finish (wait_secs = 300 )
113
120
114
121
assert run_result is not None
115
122
assert run_result ['status' ] == 'SUCCEEDED'
116
123
assert run_result ['statusMessage' ] == 'testing-status-message'
117
124
assert run_result ['isStatusMessageTerminal' ] is None
118
125
119
- run_result = await actor .call (run_input = {'is_terminal' : True })
126
+ call_result_2 = await actor .call (run_input = {'is_terminal' : True })
127
+ assert call_result_2 is not None
120
128
121
- assert run_result is not None
122
- assert run_result ['status' ] == 'SUCCEEDED'
123
- assert run_result ['statusMessage' ] == 'testing-status-message'
124
- assert run_result ['isStatusMessageTerminal' ] is True
129
+ run_client_2 = apify_client_async .run (call_result_2 ['id' ])
130
+ run_result_2 = await run_client_2 .wait_for_finish (wait_secs = 300 )
125
131
132
+ assert run_result_2 is not None
133
+ assert run_result_2 ['status' ] == 'SUCCEEDED'
134
+ assert run_result_2 ['statusMessage' ] == 'testing-status-message'
135
+ assert run_result_2 ['isStatusMessageTerminal' ] is True
126
136
127
- async def test_actor_starts_another_actor_instance (make_actor : ActorFactory ) -> None :
137
+
138
+ async def test_actor_starts_another_actor_instance (
139
+ apify_client_async : ApifyClientAsync ,
140
+ make_actor : ActorFactory ,
141
+ ) -> None :
128
142
async def main_inner () -> None :
129
143
async with Actor :
130
144
await asyncio .sleep (5 )
@@ -152,10 +166,14 @@ async def main_outer() -> None:
152
166
inner_actor_id = (await inner_actor .get () or {})['id' ]
153
167
test_value = crypto_random_object_id ()
154
168
155
- outer_run_result = await outer_actor .call (run_input = {'test_value' : test_value , 'inner_actor_id' : inner_actor_id })
169
+ outer_call_result = await outer_actor .call (run_input = {'test_value' : test_value , 'inner_actor_id' : inner_actor_id })
170
+ assert outer_call_result is not None
156
171
157
- assert outer_run_result is not None
158
- assert outer_run_result ['status' ] == 'SUCCEEDED'
172
+ run_client_outer = apify_client_async .run (outer_call_result ['id' ])
173
+ run_result_outer = await run_client_outer .wait_for_finish (wait_secs = 300 )
174
+
175
+ assert run_result_outer is not None
176
+ assert run_result_outer ['status' ] == 'SUCCEEDED'
159
177
160
178
await inner_actor .last_run ().wait_for_finish ()
161
179
0 commit comments