Skip to content

Commit fb918d3

Browse files
committed
fix flakiness
1 parent 5fe8c40 commit fb918d3

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

‎tests/integration/test_store.py‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,12 @@ async def test_store_list_sort_by_popularity(client: ApifyClient | ApifyClientAs
7373
page = await maybe_await(client.store().list(limit=10, sort_by='popularity'))
7474
assert isinstance(page, ListOfStoreActors)
7575
assert len(page.items) > 0
76-
# `total_users` is the strongest single-field proxy for popularity in the public store —
77-
# verify the result is at least non-increasing in that metric (ties allowed).
76+
# `popularity` is a composite ranking, not a strict sort on any single field, so we only
77+
# check the directional invariant: the top-ranked item has at least as many total users as
78+
# the bottom-ranked one on the page.
7879
total_users = [a.stats.total_users for a in page.items if a.stats.total_users is not None]
7980
assert total_users, 'expected at least one item with populated stats.total_users'
80-
assert total_users == sorted(total_users, reverse=True)
81+
assert total_users[0] >= total_users[-1]
8182

8283

8384
async def test_store_iterate(client: ApifyClient | ApifyClientAsync, *, is_async: bool) -> None:

0 commit comments

Comments
 (0)