Skip to content

test: Assert RequestList persists the expected request contents#2027

Merged
vdusek merged 1 commit into
apify:masterfrom
anxkhn:test/request-list-assert-persisted-contents
Jul 7, 2026
Merged

test: Assert RequestList persists the expected request contents#2027
vdusek merged 1 commit into
apify:masterfrom
anxkhn:test/request-list-assert-persisted-contents

Conversation

@anxkhn

@anxkhn anxkhn commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Three of the RequestList persistence tests in
tests/unit/request_loaders/test_request_list.py build a persisted value in the
key-value store and then only assert persisted_data is not None. Each of their
docstrings/comments claims to verify the actual persisted request set, but the
contents were never checked, so a regression that persisted the wrong URLs, an
empty list where data was expected, or a malformed structure would still pass.

This adds one content assertion per test on top of the existing null check:

  • test_persist_requests_key_with_sync_iterable: the persisted URLs equal the
    three input URLs (docstring: "persists request data").
  • test_persist_requests_key_with_empty_iterator: persisted_data['requests']
    equals [] (comment: "empty requests were persisted").
  • test_handle_invalid_url_with_persistence: the persisted URLs are exactly
    ['https://valid.placeholder.com'], so the invalid URL is excluded (comment:
    "the valid URL was persisted and the invalid one was not").

The existing assert persisted_data is not None lines are kept: they narrow the
type before the new subscripting.

No production code changes; this only strengthens existing assertions.

Issues

  • No related open issue. Self-identified test gap.

Testing

  • uv run pytest tests/unit/request_loaders/test_request_list.py -v -> 11 passed.
  • uv run poe lint (ruff format check + ruff check) -> clean on the changed file.
  • uv run poe type-check -> no new diagnostics from this change.
  • Confirmed each new assertion is load-bearing: temporarily changing an expected
    value makes exactly that test fail, and reverting restores green.

Checklist

  • CI passed

@vdusek vdusek changed the title test(request_loaders): assert persisted request contents in RequestList tests test: Assert RequestList persists the expected request contents Jul 7, 2026
@vdusek vdusek merged commit 63c3e23 into apify:master Jul 7, 2026
35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants