Skip to content

Commit 1689a1e

Browse files
authored
chore: Add more RQ integration tests (#518)
- Add more integration tests for RQ (mostly to better test the new Apify RQ in the #470). - Utilization of `Actor.log` - as they are seen in the test output.
1 parent 4c3d077 commit 1689a1e

File tree

2 files changed

+1133
-31
lines changed

2 files changed

+1133
-31
lines changed

tests/integration/README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,3 +126,26 @@ async def test_something(
126126

127127
assert actor_run.status == 'SUCCEEDED'
128128
```
129+
130+
### Asserts
131+
132+
Since test Actors are not executed as standard pytest tests, we don't get introspection of assertion expressions. In case of failure, only a bare `AssertionError` is shown, without the left and right values. This means, we must include explicit assertion messages to aid potential debugging.
133+
134+
```python
135+
async def test_add_and_fetch_requests(
136+
make_actor: MakeActorFunction,
137+
run_actor: RunActorFunction,
138+
) -> None:
139+
"""Test basic functionality of adding and fetching requests."""
140+
141+
async def main() -> None:
142+
async with Actor:
143+
rq = await Actor.open_request_queue()
144+
await rq.add_request(f'https://apify.com/')
145+
assert is_finished is False, f'is_finished={is_finished}'
146+
147+
actor = await make_actor(label='rq-test', main_func=main)
148+
run_result = await run_actor(actor)
149+
150+
assert run_result.status == 'SUCCEEDED'
151+
```

0 commit comments

Comments
 (0)