Skip to content

Commit a782693

Browse files
committed
Small fix to actor events integration tests
1 parent 23ffda0 commit a782693

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

tests/integration/test_actor_events.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,17 @@ async def main() -> None:
1818
os.environ[ApifyEnvVars.PERSIST_STATE_INTERVAL_MILLIS] = '900'
1919

2020
was_system_info_emitted = False
21+
system_infos = []
2122

2223
def on_event(event_type: ActorEventTypes) -> Callable:
2324
async def log_event(data: Any) -> None:
2425
nonlocal was_system_info_emitted
26+
nonlocal system_infos
2527
print(f'Got actor event ({event_type=}, {data=})')
2628
await Actor.push_data({'event_type': event_type, 'data': data})
2729
if event_type == ActorEventTypes.SYSTEM_INFO:
2830
was_system_info_emitted = True
29-
# Check that parsing datetimes works correctly
30-
# Check `createdAt` is a datetime (so it's the same locally and on platform)
31-
assert isinstance(data[0]['createdAt'], datetime)
31+
system_infos.append(data)
3232

3333
return log_event
3434

@@ -43,6 +43,10 @@ async def log_event(data: Any) -> None:
4343
break
4444
await asyncio.sleep(1)
4545

46+
# Check that parsing datetimes works correctly
47+
# Check `createdAt` is a datetime (so it's the same locally and on platform)
48+
assert isinstance(system_infos[0]['createdAt'], datetime)
49+
4650
actor = await make_actor('actor-interval-events', main_func=main)
4751

4852
run_result = await actor.call()

0 commit comments

Comments
 (0)